A
A
Anton2020-04-20 21:47:18
PHP
Anton, 2020-04-20 21:47:18

How to find nearest gps coordinates?

I request the coordinates of points in the city:

foreach ($data as $Full) 
{echo $Full['GPS'];};


Will give, for example:

55.0461612.60.1068595
55.058817.60.107156
55.1352482.60.1488734
55.150504.60.151353
55.041317.60.111684
52.1352482.62.1484734
57.1505.61.151334
51334.6.61.5133.6.61A

And there are two variables that contain the exact address
echo $geo[lat];
echo $geo[lon];

Will give, for example:

55.0472483
and
60.096523

What is the best way to compare and make a condition to select, for example, 3 nearest points?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2020-04-20
@anton99zel

If the shortest geographically, then consider the distance along the arc of the great circle .
And if for a person, then there are a lot of factors. For example, the geographically closest point is 200 meters across the river, but the bridge is 10 kilometers away. Or to one point an hour on foot, and to a further 15 minutes by bus.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question