views:

39

answers:

1

Hi guys, i'm trying to get the longitude and latitude for an address with the google maps api, but I don't know how to do it?This is an example of what i'm trying:

GoogleObjectAdress("New york") -> and it should return the longitude and latitude for me!

Any solutions?

+1  A: 

Try the following code:

<script src="http://maps.google.com/maps?file=api&amp;amp;v=2.x&amp;amp;key=YourApiKey"
 type="text/javascript"></script>

var geocoder = new GClientGeocoder();
geocoder.getLatLng("New York", function(point) { 
    //code
});

For more information, read the documentation.

SLaks