diasansley Posted February 9, 2011 Share Posted February 9, 2011 hi guys here is my code i cant get a way to show multiple images for the map based on the address im using a geo coder. if i change imageicon=images[0] ; the 0 to 1 it prints the second image i am unable to get both printed Can some1 direct me to link or please provide me with a solution :'(. while($row = mysql_fetch_array($rs)){ $lat = $lat.$row['lat'].','; $long = $long.$row['lng'].','; $type = $type.$row['type'].','; $add = $add.$row['address'].','; $name = $name.$row['name'].','; $zip = $zip.$row['pincode'].','; } mysql_close($conn); ?> <script type="text/javascript"> function initialize() { images = ["play_white_1.png","play_white.png"]; var geocoder; geocoder = new google.maps.Geocoder(); var latlng = new google.maps.LatLng(-34.397, 150.644); var myOptions = { zoom: 5, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP, } var map; map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); var address = new Array(); address = "<?php echo $add; ?>"; for(var i=0;i<address.length;i++) { geocoder.geocode( { 'address': address[i] }, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); var imageicon = ""; imageicon=images[0] ; var marker = new google.maps.Marker({ map: map, position: results[0].geometry.location, icon:imageicon }); marker.setMap(map); } }); } } </script> <body onload="initialize()"> <div id="map_canvas" style="width: 500px; height: 480px;"></div> </body> thanks Link to comment https://forums.phpfreaks.com/topic/227137-multiple-image-for-geocoder-map/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.