Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>try this,hope you will understand,<strong>google map marker for multiple pin out example,you can populate lat,long through array</strong></p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="content-type" content="text/html; charset=UTF-8" /&gt; &lt;title&gt;Google Maps Multiple Markers&lt;/title&gt; &lt;script src="http://maps.google.com/maps/api/js?sensor=false"&gt;&lt;/script&gt; &lt;script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.10.1.min.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="map" style="width: 500px; height: 400px;"&gt;&lt;/div&gt; &lt;script type="text/javascript"&gt; // Define your locations: HTML content for the info window, latitude, longitude var locations = [ ['&lt;h4&gt;Bondi Beach&lt;/h4&gt;', -33.890542, 151.274856], ['&lt;h4&gt;Coogee Beach&lt;/h4&gt;', -33.923036, 151.259052], ['&lt;h4&gt;Cronulla Beach&lt;/h4&gt;', -34.028249, 151.157507], ['&lt;h4&gt;Manly Beach&lt;/h4&gt;', -33.80010128657071, 151.28747820854187], ['&lt;h4&gt;Maroubra Beach&lt;/h4&gt;', -33.950198, 151.259302] ]; // Setup the different icons and shadows var iconURLPrefix = 'http://maps.google.com/mapfiles/ms/icons/'; var icons = [ iconURLPrefix + 'red-dot.png', iconURLPrefix + 'green-dot.png', iconURLPrefix + 'blue-dot.png', iconURLPrefix + 'orange-dot.png', iconURLPrefix + 'purple-dot.png', iconURLPrefix + 'pink-dot.png', iconURLPrefix + 'yellow-dot.png' ] var icons_length = icons.length; var shadow = { anchor: new google.maps.Point(15,33), url: iconURLPrefix + 'msmarker.shadow.png' }; var map = new google.maps.Map(document.getElementById('map'), { zoom: 10, center: new google.maps.LatLng(-37.92, 151.25), mapTypeId: google.maps.MapTypeId.ROADMAP, mapTypeControl: false, streetViewControl: false, panControl: false, zoomControlOptions: { position: google.maps.ControlPosition.LEFT_BOTTOM } }); var infowindow = new google.maps.InfoWindow({ maxWidth: 160 }); var marker; var markers = new Array(); var iconCounter = 0; // Add the markers and infowindows to the map for (var i = 0; i &lt; locations.length; i++) { marker = new google.maps.Marker({ position: new google.maps.LatLng(locations[i][1], locations[i][2]), map: map, icon : icons[iconCounter], shadow: shadow }); markers.push(marker); google.maps.event.addListener(marker, 'click', (function(marker, i) { return function() { infowindow.setContent(locations[i][0]); infowindow.open(map, marker); } })(marker, i)); iconCounter++; // We only have a limited number of possible icon colors, so we may have to restart the counter if(iconCounter &gt;= icons_length){ iconCounter = 0; } } function AutoCenter() { // Create a new viewpoint bound var bounds = new google.maps.LatLngBounds(); // Go through each... $.each(markers, function (index, marker) { bounds.extend(marker.position); }); // Fit these bounds to the map map.fitBounds(bounds); } AutoCenter(); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload