1: function getLatLng(address) {
2: //alert('getting the center of the circle');
3: if (GBrowserIsCompatible()) {
4: var geocoder = new GClientGeocoder();
5:
6: geocoder.getLatLng(address, function(latlng) {
7: if (!latlng) {
8: alert('"' + address + '" not found');
9: return false;
10: } else {
11: return {'Lat':latlng.lat().toFixed(6), 'Lng':latlng.lng().toFixed(6)};
13: }
14: });
15: }
16: }
This works only for compartible browsers. You can check browser compatibility using GBrowserIsCompatible() and of course you need to include the API using
1: <script src="http://maps.google.com/maps?file=api&v=2&key=abcdef" type="text/javascript"></script>
Aucun commentaire:
Enregistrer un commentaire