Is there a google maps api that will allow you to pass in a location name and it will return coordinates that point to the location on googlemaps?
Asked
Active
Viewed 401 times
3
-
I didn't even know that the Google Maps Data API is no longer available: http://code.google.com/intl/nl/apis/maps/documentation/mapsdata/ they offer an alternative. – Harmen Jul 14 '11 at 17:58
3 Answers
2
Here is the The Google Geocoding API
Here is a example request:
http://maps.googleapis.com/maps/api/geocode/xml?address=Berlin&sensor=false
You can filter the result: for geometry/location/lat
and lng
<GeocodeResponse>
<status>OK</status>
<result>
<type>locality</type>
<type>political</type>
<formatted_address>Berlin, Deutschland</formatted_address>
[…]
<geometry>
<location>
<lat>52.5234051</lat>
<lng>13.4113999</lng>
</location>
<location_type>APPROXIMATE</location_type>
<viewport>[…]</viewport>
<bounds>[…]</bounds>
</geometry>
</result>
</GeocodeResponse>

timaschew
- 16,254
- 6
- 61
- 78
0
Yup, need to use reverse geolocation. You can send an address or location string and it will give you an array of the possible lat/Long coordinates for it. These are GeocoderResults and normally the first one is what you want. Like, if you wanted the USA you could do
geocoder.geocode( {'address': 'USA' }, function(results, status) {
response($.map(results, function(item) {
var latlng = new google.maps.LatLng( item.geometry.location.lat(), item.geometry.location.lng());
//Do some action with the provided latlng
}));
});

David Rice
- 1,111
- 1
- 11
- 24
0
Mappy also provide a same free service. Have a look to mappy.com and search for rest api.

ChristopheCVB
- 7,269
- 1
- 29
- 54