2
Hello.
I’m mounting a system to find the nearest service provider to the zip code.
For this I used the script below to convert cep in coordinate.
$cep = "01238010";
$geocode = file_get_contents('http://maps.google.com/maps/api/geocode/json?address='.$cep.'&sensor=false');
$output= json_decode($geocode);
$lat = $output->results[0]->geometry->location->lat;
$long = $output->results[0]->geometry->location->lng;
How do I find the providers who are within 5km of that coordinate?
I have a mysql database with the registered ceps and coordinates of the providers.
I’m using PHP and Mysql.
Thank you!
vc will have you set up a logarithm , maybe a mysql file. the account is this one . http://www.pilotopolicial.com.br/calculando-distancias-e-direcoes-utilizando-coordenadas-geograficas/
– Jasar Orion
In your Mysql database are the positions on the map of the providers using spatial data type? (POINT)
– Pagotti