Help Distance matrix matrix API - Google Maps

0

I would like to know if with the distances API - Google Maps it is possible to calculate the distance of a city among others at a single time.

For example: calculate the distance from New York to Paris, from New York to Peking, from New York to Madrid?

And if not, how can I do with php go taking the answer from the following URL and keep only the KM:

link

{
    "destination_addresses" : [ "Rio de Janeiro, Rio de Janeiro - RJ, Brasil" ],
    "origin_addresses" : [ "Porto Alegre, Porto Alegre - RS, Brasil" ],
    "rows" : [
    {
        "elements" : [
        {
            "distance" : {
                "text" : "1.570 km",
                "value" : 1570193
            },
            "duration" : {
                "text" : "18 horas 5 minutos",
                "value" : 65097
            },
            "status" : "OK"
        } ]
    } ],
    "status" : "OK"
}

I need this to later verify if there is a distance of less than 50km between one location and another.

    
asked by nattadsa 25.04.2016 в 19:21
source

1 answer

1

Yes it is possible, only that the calculation will be made between the points registered as the center of the city, without taking into account the real distance between the exit of the first city, and the entrance of the second

    
answered by 11.11.2016 в 02:55