Reputation: 1403
I would like to create a random GeoPoint within 50 feet of a given GeoPoint. (Using SQL Server 2008 or IPhone SDK)
Can I just add some number to the long & lat to create this random Geopoint?
Example:
mylatdistance = Random(1,50) newlat = lat + mylatdistance
or
Is this a Spatial SQL/area problem?
Thanks
Upvotes: 1
Views: 956
Reputation: 45105
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.
Upvotes: 1