How to get GPS coordinates from an address

Very useful but quiet hard to find. I knew there must be some way how to get GPS coordinated for an address using Google Maps API but it took me some time to find out how.

But then I found this:

http://maps.google.com/maps/geo?q=__address__&oe=utf8&hl=en
so for example:
http://maps.google.com/maps/geo?q=Chr%C3%A1m%20svat%C3%A9ho%20V%C3%ADta,%20Praha&oe=utf8&hl=en

and output is following JSON:

 1 
 2 
 3 
 4 
 5 
 6 
 7 
 8 
 9 
 10 
 11 
 12 
 13 
 14 
 15 
 16 
 17 
 18 
 19 
 20 
 21 
{
    "name": "Chram svateho Vita, Praha",
    "Status": {
        "code": 200,
        "request": "geocode"
    },
    "Placemark": [ {
        "id": "p1",
        "address": "Prague Cathedral, Hrad III. nadvori, 119 00 Prague 5, Czech Republic",
        "AddressDetails": {
            "Accuracy" : 9,
            "Country" : { ... }
        },
    },
    { ... },
    { ... } ],
        
    "Point": {
        "coordinates": [ 14.3999027, 50.0906104, 0 ]
    }
}

Arguments are pretty clear:

Eventually, and I think if you want just GPS coordinates it's even better, you can use another parameter output:

http://maps.google.com/maps/geo?q=_address__&output=csv&oe=utf8

This does basically the same thing but it returns only coordinates. According to the previous example, the output would be:

200,9,50.0906104,14.3999027
status code, accuracy, latitude, longitude

And that's it. Although I'm using Google Maps API these services doesn't require Google API Key.

blog comments powered by Disqus