1

This is my situation:

I have clinics in database.The problem is that i want to show location for every single clinic in google maps.

I try couple ways but they didn't work.Show only for one clinic not for all.

My question: Is it possible and if is, how?

Thanks in advance(Sorry for my english).

cнŝdk
  • 31,391
  • 7
  • 56
  • 78
  • 1
    Welcome to Stack Overflow. What you want to do is certainly possible, but in order for anyone to help, you'll need to provide some more info (show your code, etc) – Nick F May 15 '15 at 13:36
  • possible duplicate of [Google Maps JS API v3 - Simple Multiple Marker Example](http://stackoverflow.com/questions/3059044/google-maps-js-api-v3-simple-multiple-marker-example) – geocodezip May 15 '15 at 13:52

1 Answers1

1

Yes it is possible, you should use google maps api for this. This is the php file i am using for similar mission. I can show diffrent cities on map using this. You can get coordinates from database.

Also there is a similar question you should check : Google Maps JS API v3 - Simple Multiple Marker Example

    <!DOCTYPE html>
    <html> 
    <head> 
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> 
    <title>Google Maps Multiple Markers</title> 
    <script src="http://maps.google.com/maps/api/js?sensor=false" 
          type="text/javascript"></script>
    </head> 
    <body>
    <div id="map" style="width: 500px; height: 400px;"></div>

     <script type="text/javascript">
     var locations = [
      ['Bondi Beach', -33.890542, 151.274856, 4],
      ['Coogee Beach', -33.923036, 151.259052, 5],
      ['Cronulla Beach', -34.028249, 151.157507, 3],
      ['Manly Beach', -33.80010128657071, 151.28747820854187, 2],
      ['Maroubra Beach', -33.950198, 151.259302, 1]
    ];

    var map = new google.maps.Map(document.getElementById('map'), {
      zoom: 10,
      center: new google.maps.LatLng(-33.92, 151.25),
      mapTypeId: google.maps.MapTypeId.ROADMAP
    });

    var infowindow = new google.maps.InfoWindow();

    var marker, i;

    for (i = 0; i < locations.length; i++) {  
      marker = new google.maps.Marker({
        position: new google.maps.LatLng(locations[i][1], locations[i][2]),
        map: map,
        icon: 'zcx.jpg'
      });

      google.maps.event.addListener(marker, 'click', (function(marker, i) {
        return function() {
          infowindow.setContent(locations[i][0]);
          infowindow.open(map, marker);
        }
      })(marker, i));
    }
  </script>
</body>
</html>
Community
  • 1
  • 1
Ali insan Soyaslan
  • 836
  • 5
  • 14
  • 33