Querying a perimeter around a Geocode-Location (Lat/Lon)

Posted by Tim on Stack Overflow See other posts from Stack Overflow or by Tim
Published on 2010-05-03T18:59:56Z Indexed on 2010/05/04 3:58 UTC
Read the original article Hit count: 196

Hi,

how can I search for geo-objects in a certain perimeter ? E.g. I have several objects with Lat/Lon coordinates stored in my DB. Now I want to retrieve all the objects which lie in a specific perimeter (10 miles or 20 miles) around a given point.

I guess what I would have to do is to form some query like:

SELECT * FROM objects o where o.lat < (myPositionLat+x) AND o.lon < (myPositionLon+y)

Is this right? How do I determine/set the values for x and y?

© Stack Overflow or respective owner

Related posts about latitude

Related posts about longitude