E
E
elailasou2015-07-14 15:18:25
Cartography
elailasou, 2015-07-14 15:18:25

Find nearest point in coordinate system?

There is a table in the database with coordinates in the format 55.888755,37.430337 and the given coordinates themselves in the same format. How to find nearest coordinates to given coordinates? The algorithm itself is interesting, not the code of course =)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
D', 2015-07-14
@junk1114

1) We take an array with points
2) We take a given point
3) Find the distance between points
4) ???
5) Profit!!1
PS
By reference, the formula for the coordinates on the plane. If necessary, taking into account the curvature of the earth -> google.

T
TomasHuk, 2015-07-14
@TomasHuk

I will write the algorithm "on the forehead".
Walk through each point in the database - find the distance between two points (between a given point and a point in the database);
Among these values, find the minimum.

S
Sergey, 2015-07-14
@begemot_sun

If there are many (very many) points, then the search can be narrowed down using a hashcode comparison.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question