google Maps JavaScript API By Example

Below written code is a example of google map api which you can find from google when you sign up for google map. Using your site url and also there are a key that’s are valid only for your given link or site.
Hope your script running nice But one things!

You may confused!
<code>
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
</code>
How can you set GLatlng parameter! is not it?
yap This two parameter is

1) Latitude
2) Longitude

For More about Latitude and Longitude Just search in google by writing
1) define:Latitude
2) define:Longitude

You may understand just visit this link(By Yahoo inc) where you find a given addresses latitude and longitude
http://www.batchgeocode.com/lookup/

Suppose your address is
1304 Chicago Ave, Evanston, IL 60201
Then
Enter this address in Map It! field
1304 Chicago Ave, Evanston, IL 60201

By click on Map It you got latitude and longitude’s value then add it in google api code.

<!DOCTYPE HTML>
<html>
<head>
<title>Google Maps JavaScript API Example</title>
http://maps.google.com/maps?file=api&v=2&key=YOUR_KEY
<script type="text/javascript">

//<![CDATA[

function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
}
}

//]]>
</script>
</head>
<body onload="load()" onunload="GUnload()">
<div id="map" style="width: 500px; height: 300px"></div>
</body>
</html>

Thanks again

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 )

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: