我正在SQL Server 2008中设计一个表,用于存储用户列表和Google Maps坐标(经度和纬度).
我需要两个字段,还是可以用1完成?
用于存储此类数据的最佳(或最常见)数据类型是什么?
有没有人实现过这个,或者知道是否难以实现这个/有任何指针?
public static SpatialRelationCriterion IsWithinDistance(string propertyName, object anotherGeometry, double distance)
{
// TODO: Implement
throw new NotImplementedException();
}
Run Code Online (Sandbox Code Playgroud)
来自NHibernate.Spatial.Criterion.SpatialRestrictions
我可以在hql中使用"NHSP.Distance(PROPERTY,:point)".但是想要将此查询与我现有的Criteria查询相结合.
目前我正在创建一个粗糙的多边形,并使用
criteria.Add(SpatialRestrictions.Intersects("PROPERTY", myPolygon));
Run Code Online (Sandbox Code Playgroud)
编辑 通过在SpatialRelationCriterion上重载构造函数来获得原型,添加新的SpatialRelation.Distance
public static SpatialRelationCriterion IsWithinDistance(string propertyName, object anotherGeometry, double distance)
{
return new SpatialRelationCriterion(propertyName, SpatialRelation.Distance, anotherGeometry, distance);
}
Run Code Online (Sandbox Code Playgroud)
为SpatialRelationCriterion添加了一个新字段
private readonly double? distance;
public SpatialRelationCriterion(string propertyName, SpatialRelation relation, object anotherGeometry, double distance)
: this(propertyName, relation, anotherGeometry)
{
this.distance = distance;
}
Run Code Online (Sandbox Code Playgroud)
编辑ToSqlString
object secondGeometry = Parameter.Placeholder;
if (!(this.anotherGeometry is IGeometry))
{
secondGeometry = columns2[i];
}
if …
Run Code Online (Sandbox Code Playgroud) 我想根据@data数据框中的相应属性值从SpatialPolygonsDataFrame对象中删除一些多边形,以便我可以绘制简化/子集化的shapefile.到目前为止,我还没有找到办法做到这一点.
例如,假设我要删除此世界shapefile中面积小于30000的所有多边形.我将如何进行此操作?
或者,同样,我如何删除Antartica?
require(maptools)
getinfo.shape("TM_WORLD_BORDERS_SIMPL-0.3.shp")
# Shapefile type: Polygon, (5), # of Shapes: 246
world.map <- readShapeSpatial("TM_WORLD_BORDERS_SIMPL-0.3.shp")
class(world.map)
# [1] "SpatialPolygonsDataFrame"
# attr(,"package")
# [1] "sp"
head(world.map@data)
# FIPS ISO2 ISO3 UN NAME AREA POP2005 REGION SUBREGION LON LAT
# 0 AC AG ATG 28 Antigua and Barbuda 44 83039 19 29 -61.783 17.078
# 1 AG DZ DZA 12 Algeria 238174 32854159 2 15 2.632 28.163
# 2 AJ AZ AZE 31 Azerbaijan 8260 8352021 142 145 …
Run Code Online (Sandbox Code Playgroud) 你们有没有使用NoSQL(非关系型)数据库存储空间数据的经验?是否有任何潜在的好处(速度,空间......)使用这些数据库来保存桌面应用程序的数据(与使用SpatiaLite或PostGIS相比)?
我已经看过关于将MongoDB用于空间数据的帖子,但我对一些性能比较感兴趣.
几乎所有PostGIS中的功能都以ST开头.例如ST_Distance_Sphere,ST_GeomFromText,ST_Intersection等.
ST是什么意思?
http://www.postgis.org/documentation/manual-svn/PostGIS_Special_Functions_Index.html
问题: 对于点位置,在Python中计算反距离加权(IDW)插值的最佳方法是什么?
一些背景: 目前我正在使用RPy2与R及其gstat模块进行交互.不幸的是,gstat模块与arcgisscripting冲突,我通过在单独的进程中运行基于RPy2的分析来解决这个问题.即使在最近/未来版本中解决了这个问题,并且效率可以提高,我仍然希望删除我对安装R的依赖.
gstat网站确实提供了一个独立的可执行文件,使用我的python脚本更容易打包,但我仍然希望Python解决方案不需要多次写入磁盘并启动外部进程.插值函数的调用次数,单独的点和值集,在我正在执行的处理中可以接近20,000.
我特别需要为点进行插值,因此在性能方面使用ArcGIS中的IDW函数生成比使用R更严重的栅格声音.....除非有办法有效地屏蔽掉我需要的点.即使进行了这种修改,我也不希望性能如此出色.我会将此选项作为另一种选择.更新:这里的问题是你绑定到您正在使用的单元格大小.如果减小单元大小以获得更好的准确性,则处理需要很长时间.如果你想要特定点的值,你还需要通过点数提取来跟进所有丑陋的方法.
我看过scipy文档,但看起来没有一种直接计算IDW的方法.
我正在考虑滚动我自己的实现,可能使用一些scipy功能来定位最近的点并计算距离.
我错过了一些明显的东西吗 是否有一个我没见过的python模块完全符合我的要求?在scipy的帮助下创建自己的实现是明智的选择吗?
我有(再次)在R中组合数据帧的问题.但这一次,一个是SpatialPolygonDataFrame(SPDF
),另一个是通常的data.frame(DF
).将SPDF
有大约1000行的DF
只有400两者有一个共同的列,QDGC
现在,我试过了
oo <- merge(SPDF,DF, by="QDGC", all=T)
Run Code Online (Sandbox Code Playgroud)
但这只会导致正常的data.frame,而不再是空间多边形数据框.我在其他地方读到,这不起作用,但我不明白在这种情况下该做什么(必须对ID列做一些事情,合并使用)
哦,这么难的问题,我...
谢谢!延
使用DbGeography.Distance(otherLocation)
距离的单位测量两个位置之间 的距离时?
甚至msdn信息和intellisense都无法指定距离的单位.
有谁知道?
[编辑]我正在使用srid 4326.大多数例子似乎都在使用.从我所能找到的,4326似乎是弧度,这让我完全无能为力.弧度用于测量角度/度数,那么这实际上意味着什么呢?
我有两个SpatialPolygonsDataFrame
文件:dat1,dat2
extent(dat1)
class : Extent
xmin : -180
xmax : 180
ymin : -90
ymax : 90
extent(dat2)
class : Extent
xmin : -120.0014
xmax : -109.9997
ymin : 48.99944
ymax : 60
Run Code Online (Sandbox Code Playgroud)
我想使用dat2的范围裁剪文件dat1.我不知道怎么做.我之前只使用"crop"函数处理光栅文件.
当我将此函数用于当前数据时,会发生以下错误:
> r1 <- crop(BiomassCarbon.shp,alberta.shp)
Error in function (classes, fdef, mtable) :
unable to find an inherited method for function ‘crop’ for signature"SpatialPolygonsDataFrame"’
Run Code Online (Sandbox Code Playgroud) spatial ×10
r ×3
gis ×2
.net ×1
c# ×1
criteria-api ×1
crop ×1
dataframe ×1
geospatial ×1
gps ×1
mapping ×1
merge ×1
nhibernate ×1
nosql ×1
numpy ×1
polygon ×1
postgis ×1
postgresql ×1
python ×1
r-maptools ×1
scipy ×1
spatialite ×1
sql-server ×1
terminology ×1