Google provides a FREE Java Script map API for longitude & latitude. Simple demonstration is given below. Position marker, mouse wheel zooming, Map view/Satelite view/Hybrid view controls are enabled in the example.
NOTE :- Map searching is commented.
<html>
<head>
<script type="text/javascript"
src="http://www.google.com/jsapi?key=ABCDEFG"></script>
<script type="text/javascript">
google.load("maps", "2");
// google.load("search", "1");
<head>
<script type="text/javascript"
src="http://www.google.com/jsapi?key=ABCDEFG"></script>
<script type="text/javascript">
google.load("maps", "2");
// google.load("search", "1");
// Call this function when the page has been loaded
function initialize() {
var map = new google.maps.Map2(document.getElementById("map"));
map.setCenter(new google.maps.LatLng(7, 80), 13);
map.enableRotation();
map.addControl(new GOverviewMapControl());
map.enableDoubleClickZoom();
map.enableScrollWheelZoom();
map.addControl(new GMapTypeControl());
map.addControl(new GSmallMapControl());
function initialize() {
var map = new google.maps.Map2(document.getElementById("map"));
map.setCenter(new google.maps.LatLng(7, 80), 13);
map.enableRotation();
map.addControl(new GOverviewMapControl());
map.enableDoubleClickZoom();
map.enableScrollWheelZoom();
map.addControl(new GMapTypeControl());
map.addControl(new GSmallMapControl());
var marker = new GMarker(new GLatLng(7, 80));
map.addOverlay(marker);
map.setMapType(G_SATELLITE_MAP);
// var searchControl = new google.search.SearchControl();
// searchControl.addSearcher(new google.search.WebSearch());
// searchControl.addSearcher(new google.search.NewsSearch());
// searchControl.draw(document.getElementById("searchcontrol"));
}
google.setOnLoadCallback(initialize);
</script>
map.addOverlay(marker);
map.setMapType(G_SATELLITE_MAP);
// var searchControl = new google.search.SearchControl();
// searchControl.addSearcher(new google.search.WebSearch());
// searchControl.addSearcher(new google.search.NewsSearch());
// searchControl.draw(document.getElementById("searchcontrol"));
}
google.setOnLoadCallback(initialize);
</script>
</head>
<body>
<div id="map" style="width: 500px; height: 500px"></div>
<!-- <div id="searchcontrol"></div> -->
</body>
<body>
<div id="map" style="width: 500px; height: 500px"></div>
<!-- <div id="searchcontrol"></div> -->
</body>
</html>
Reference :- http://code.google.com/apis/ajax/documentation/
No comments:
Post a Comment