Perimeter request around Geocode location (Lat / Lon)

How can I search for geo objects by a certain perimeter? For instance. I have several objects with Lat / Lon coordinates stored in my database. Now I want to get all the objects that lie in a certain perimeter (10 miles or 20 miles) around a certain point.

I assume that I will need to make the following query:

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

Is it correct? How to determine / set values ​​for x and y?

+3
source share
1 answer

, . 111 (69 ) , 111 .

40 ° 85 (53 ), 111 (). , , x y.

, , . , haversine. , / Chris Veness.

, . .

, , . MySQL, PostgreSQL SQL Server 2008 ( ), haversine.

+1

Source: https://habr.com/ru/post/1743872/


All Articles