Jump to content

Display Multiple Point On Google map


mostafa_dadgar

Recommended Posts

This is a slimmed down version of one i used

<!DOCTYPE html><html><head><scriptsrc="http://maps.googleapis.com/maps/api/js?key=AIzaSyDY0kkJiTPVd2U7aTOAwhc9ySH6oHxOIYM&sensor=false"></script><script>// Set location to centre onvar myCenter=new google.maps.LatLng(51.508742,-0.120850);// Set other locations in array first title for marker, second coordsvar locations = [['marker title1', -13.530825,-71.957565],['marker title2', -13.531211,-71.961921],['marker title3', -13.531336,-71.960387],['marker title4', -13.533099,-71.960151],['marker title5', -13.533985,-71.960751],['marker title6', -13.535289,-71.962929],['marker title7', -13.516617,-71.978872],['marker title8', -13.515626,-71.975873],['marker title9', -13.531847,-71.984493],['marker title10', -13.50123,-72.031091],['marker title11', -13.163152,-72.54581]];function initialize(){//apply location marker to centre onvar mapProp = {  center:myCenter,  zoom:5,  mapTypeId:google.maps.MapTypeId.ROADMAP  };var map=new google.maps.Map(document.getElementById("googleMap"),mapProp);var marker=new google.maps.Marker({position:myCenter,title: 'My centre location marker'});marker.setMap(map);// apply other location markersfor (i = 0; i < locations.length; i++) {marker = new google.maps.Marker({position: new google.maps.LatLng(locations[i][1], locations[i][2]),map: map,title: locations[i][0]});}}google.maps.event.addDomListener(window, 'load', initialize);</script></head><body><div id="googleMap" style="width:500px;height:380px;"></div></body></html>

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...