Find the Latitude and Longitude using Gmap


Hi,

Google gives the great Javascript Api for finding the Location latitude and longitude by just giving the address only

This is following code

<script src=”http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=true&amp;key=ABQIAAAANez3-95VQQxZUR1e1BaC7RQlRyH5qh-HDT3ImsMIYwyhpUeTghSwTS8yZGHT9D9mFG6mgXkotPdcKw&#8221; type=”text/javascript”></script>

var address =’chennai’;

var geocoder = new GClientGeocoder();

if ( geocoder ) {
geocoder.getLatLng(
address,
function(point) {
if ( !point ) {
//alert(address + ” not found”);
$(“#error”).html(address + ” not found”);
$(“#mapurl”).focus();
} else {
$(“#wp_geo_latitude”).val(point.lat());
$(“#wp_geo_longitude”).val(point.lng());
}
}
);
}
});

if you need more details please visit here

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s