我想在给定 GeoPoint 的 50 英尺内创建一个随机 GeoPoint。(使用 SQL Server 2008 或 iPhone SDK)
我可以在 long 和 lat 添加一些数字来创建这个随机 Geopoint 吗?
例子:
mylatdistance = Random(1,50) newlat = lat + mylatdistance
或者
这是空间 SQL/区域问题吗?
谢谢
我想在给定 GeoPoint 的 50 英尺内创建一个随机 GeoPoint。(使用 SQL Server 2008 或 iPhone SDK)
我可以在 long 和 lat 添加一些数字来创建这个随机 Geopoint 吗?
例子:
mylatdistance = Random(1,50) newlat = lat + mylatdistance
或者
这是空间 SQL/区域问题吗?
谢谢
That approach should work, as long as you scale the delta_longitude values by a factor of 1/cos(latitude), since 1 degree of latitude only equals 1 degree of longitude at the equator. If you don't do this scaling, your random ensemble of points will get more "squashed" in the longitude dimension as your center point moves away from the equator.