Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Maps : Issue regarding marker icons and geocoding
    primarykey
    data
    text
    <p>I have created a jsp where i have converted the addresses into markers using geocoder class in google maps. Now the only problem i'm facing is that when i'm trying to change icon image for the marker, i'm only getting last icon for all the marker.</p> <pre><code>&lt;script type="text/javascript"&gt; var geocoder; var address = new Array(); var marker = new Array(); var images=["A","B","C","D","E","F","G","H","I","J","K","L"]; function initialize() { var locations = new String("&lt;%=request.getParameter("location")%&gt;"); locations=locations.substring(0,(locations.length)-1); var map = new google.maps.Map(document.getElementById('googleMap'), { mapTypeId: google.maps.MapTypeId.ROADMAP, zoom: 8 }); if(locations=='null' || locations=='') locations = 'Pune, INDIA\;'; address = locations.split('\;'); marker[0] = new google.maps.Marker({ map:map }); geocoder = new google.maps.Geocoder(); var i=1; for(i=1; i&lt;address.length; i++){ geocoder.geocode({ 'address': address[i]+", India" },function(results, status){ if(status == google.maps.GeocoderStatus.OK) { var marker = new google.maps.Marker({ map: map, icon: 'http://www.google.com/mapfiles/marker'+images[i]+'.png', position: results[0].geometry.location }); var info = new google.maps.InfoWindow({ content: address[i]+', India' }); google.maps.event.addListener(marker, 'click', function() { info.open(map, marker); }); } }); } geocoder.geocode({ 'address': address[0]+", India" },function(results, status){ if(status == google.maps.GeocoderStatus.OK) { marker[0].setPosition(results[0].geometry.location); map.setCenter(results[0].geometry.location); new google.maps.Circle({ center: results[0].geometry.location, radius: radius * 1000, // Convert to meters fillColor: '#00ff00', fillOpacity: 0.2, map: map, strokeColor : '#0000ff', strokeOpacity : 0.3, strokeWeight: 1 }); } }); }//End of initialize function. google.maps.event.addDomListener(window, 'load', initialize); &lt;/script&gt; </code></pre> <p>Please help !!!</p>
    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.
 

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