My Thoughts & Views

Adding Google Maps to your site

Posted on: June 11, 2007

With Google Map API its easier to add maps to web sites. Recently i was working on it and found it very simple and easy to add. Following steps will help you to add maps.

Step 1. : Register with Google( to Get a Key.
Step 2. : Add the following script in Head tag of the HTML Page

src=”” type=”text/javascript”>

Step 3.: Add a div tag as shown below inside body tag

<div id=”map” style=”width: 400px; height: 500px;”></div>
(this div will display the map)
Step4.: Add the following code to your body tag

<script type=”text/javascript”>
var map = new GMap2(document.getElementById(“map”));
map.addControl(new GSmallMapControl());
map.setCenter(new GLatLng(12.9484,77.5688), 16,null);
var marker = new GMarker(new GLatLng(12.9484,77.5688);
marker.openInfoWindowHtml(“Just bouncing along…”);


Step5.: Add latitude and longitude of the place in above code(replace the bold numbers with your lat long)

Latitude and Longitudes must be in Decimal Digits(DD) format instead of Degree Minute Second(DMS) Format.

You can get Latitude and Longitudes in DD format from Earth Tools.


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: