Good morning,
I'm making a website where users need to calculate the distance between 2 locations. Does anyone know how or where can I use a system that allows me to do this on my website?
Good morning,
I'm making a website where users need to calculate the distance between 2 locations. Does anyone know how or where can I use a system that allows me to do this on my website?
One of the options is to use API do Google Maps
. It returns the distance between two addresses and the average time between the two points.
http://maps.googleapis.com/maps/api/distancematrix/json?origins=99010030&destinations=99064090&mode=driving&language=pt-BR&sensor=false
{
"destination_addresses" : [ "São Cristovao, Passo Fundo - RS, 99064-090, Brasil" ],
"origin_addresses" : [ "Vila Popular, Passo Fundo - RS, 99010-030, Brasil" ],
"rows" : [
{
"elements" : [
{
"distance" : {
"text" : "4,7 km",
"value" : 4656
},
"duration" : {
"text" : "11 minutos",
"value" : 652
},
"status" : "OK"
}
]
}
],
"status" : "OK"
}