title: Get Markers dynamically in Google Map
body: <p>I have a list of Google map addresses in database and i want that if i give the latitude &amp; longitude of one of the address form my list.Than the all the markers comes nearer to this point.and the markers should be from my database list.</p>
  
  <p>For Example :if i have a list of 20 schools with their latitude &amp; longitude and i want the list of all schools nearer to school A may be of around 5 KM.Than all the addresses comes in map which are stored in my database not other schools which are also pins in Google map.</p>
  
  <p><strong>What i have:
  I have a script in which if i passed the latitude &amp; longitude than it gives the list nearer to this point.but the pins comes in the map is gives by Google map and i want that the pins should be from my database.</strong>  </p>
  
  <p>Here is the script you can try this at Xampp ,Wampp etc.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;title&gt;Google Maps JavaScript API v3 Example: Place Search&lt;/title&gt;
      &lt;script src="https://maps.googleapis.com/maps/api/js?sensor=true&amp;libraries=places"&gt;&lt;/script&gt;
  
      &lt;style&gt;
        #map {
          height: 400px;
          width: 600px;
          border: 1px solid #333;
          margin-top: 0.6em;
        }
      &lt;/style&gt;
  
      &lt;script&gt;
        var map;
        var infowindow;
  
        function initialize() {
          var pyrmont = new google.maps.LatLng(22.716498,75.86812);//here you can pass the latitude &amp; longitude.
  
          map = new google.maps.Map(document.getElementById('map'), {
            mapTypeId: google.maps.MapTypeId.ROADMAP,
            center: pyrmont,
            zoom: 15
          });
  
          var request = {
            location: pyrmont,
            radius: 500,
            types: ['store']
          };
          infowindow = new google.maps.InfoWindow();
          var service = new google.maps.places.PlacesService(map);
          service.search(request, callback);
        }
  
        function callback(results, status) {
          if (status == google.maps.places.PlacesServiceStatus.OK) {
            for (var i = 0; i &lt; results.length; i++) {
              createMarker(results[i]);
            }
          }
        }
  
        function createMarker(place) {
          var placeLoc = place.geometry.location;
          var marker = new google.maps.Marker({
            map: map,
            position: place.geometry.location
          });
  
          google.maps.event.addListener(marker, 'click', function() {
            infowindow.setContent(place.name);
            infowindow.open(map, this);
          });
        }
  
        google.maps.event.addDomListener(window, 'load', initialize);
      &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;div id="map"&gt;&lt;/div&gt;
      &lt;div id="text"&gt;
  
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>I Want:
  I want the list should be from my database and remember i took the entries in database from Google map API.so i don't need to create the pins they are already a pins address.</strong></p>
  
  <p>Plz suggest how can i do this.</p>