970_90

Saturday, 2 February 2013

Google map integration

Google Map - Simple Example


<script src="http://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

2 comments:

  1. Problem: How to get Client location using Google Maps API v3?

    Solution: http://stackoverflow.com/questions/3940767/how-to-get-client-location-using-google-maps-api-v3

    ReplyDelete