Saturday, 2 February 2013

Google map integration

Google Map - Simple Example


<script src="//maps.google.com/maps/api/js?sensor=true"></script>
<script>
function initialize()
{
var mapProp = {
    /** Add lat/lng of your location **/
  center:new google.maps.LatLng(51.508742,-0.120850),
  zoom:5,
  mapTypeId:google.maps.MapTypeId.ROADMAP//try SATELLITE,HYBRID,TERRAIN
  };
var map=new google.maps.Map(document.getElementById("googleMapId1"),mapProp);
}

google.maps.event.addDomListener(window, 'load', initialize);
</script>


<div id="googleMapId1" style="height: 300px; width: 650px;">
</div>


Sensor: The sensor parameter is required & it indicates whether this application uses a sensor (such as a GPS locator) to determine the user's location. Set this value to either true or false.

Zoom: The zoom property specifies the initial zoom level for the map. zoom: 0 shows a map of the Earth fully zoomed out. Higher zoom levels zoom in at a higher resolution.

MapTypeId: The mapTypeId property specifies the initial map type to display.
The following map types are supported:
  1. ROADMAP (normal, default 2D map)
  2. SATELLITE (Photographic map)
  3. HYBRID (Photographic map + roads and City)
  4. TERRAIN