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(http://www.google.com/apis/maps/signup.html) to Get a Key.
Step 2. : Add the following script in Head tag of the HTML Page
<script
src="http://maps.google.com/maps?file=api&v=2.x&key=ABC" 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.enableScrollWheelZoom();
map.addControl(new GSmallMapControl());
map.setCenter(new GLatLng(12.9484,77.5688), 16,null);
var marker = new GMarker(new GLatLng(12.9484,77.5688);
map.addOverlay(marker);
marker.openInfoWindowHtml("Just bouncing along...");
</script>
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.
No comments:
Post a Comment