title: Google geocoder limits
body: <p>Is there a way of sending multiple addresses to through one geocode request:</p>
  
  <pre><code>geocoder.geocode( { 'address': address}, function(results, status) {
      if (status == google.maps.GeocoderStatus.OK) {
          map.setCenter(results[0].geometry.location);
          addMarker(results[0].geometry.location); 
          var the_string = generate_string(elements, a, address);
  
          infowindow[a] = new google.maps.InfoWindow({
              content: the_string
          });     
  
          google.maps.event.addListener(markersArray[a], "click", function() {
              infowindow[a].open(map, markersArray[a]);
          });
      } else {
          alert("Geocode was not successful for the following reason: " + status);
      }
  });       
  </code></pre>
  
  <p>where address contains an array of addresses. Reason is I am coming across "OVER_QUERY_LIMIT" addressed here <a href="https://stackoverflow.com/questions/3529746/over-query-limit-while-using-google-maps">OVER_QUERY_LIMIT while using google maps</a> and here <a href="https://stackoverflow.com/questions/9764757/google-map-javascript-api-v3-over-query-limit-error">Google Map Javascript API v3 - OVER_QUERY_LIMIT Error</a></p>
  
  <p>I was wondering if i should start using the server side version of the client or continue with the javascript api and get help with sending an array of addresses through the geocoder call?</p>
  
  <p>In your opinion or experience, if i have an application that you can type endless amounts of addresses into fields and then press a "plot to map" button, how would you go about doing this in terms of api calls, geocoding etc?</p>
  
  <p><strong>EDIT:////////////////////////</strong></p>
  
  <p>I'm now using this code:</p>
  
  <pre><code>class geocoder{
      static private $url = "http://maps.google.com/maps/api/geocode/json?sensor=false&amp;address=";
  
      static public function getLocation($address){
          $url = self::$url.urlencode($address);
  
          $resp_json = self::curl_file_get_contents($url);
          $resp = json_decode($resp_json, true);
  
          if($resp['status']='OK'){
              return $resp['results'][0]['geometry']['location'];
          }else{
              return false;
          }
      }
  
      static private function curl_file_get_contents($URL){
          $c = curl_init();
          curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
          curl_setopt($c, CURLOPT_URL, $URL);
          $contents = curl_exec($c);
          curl_close($c);
  
          if ($contents) return $contents;
              else return FALSE;
      }
  }      
  </code></pre>
  
  <p>and calling it like so:</p>
  
  <pre><code>$address = urlencode($field_set["value"]);
  $loc = geocoder::getLocation($address);
  </code></pre>
  
  <p>in a loop of every address being placed in (in this case 20 times).</p>
  
  <p>It only places 10 markers on the map regardless of the loop correctly having 2 different lngs and lats.</p>
  
  <p>It returns null for the last 10 lat lngs :s</p>
  
  <p><strong>EDIT:///////////////////////////</strong></p>
  
  <p>I have placed a sleep in the loop that calls this:</p>
  
  <pre><code>$loc = geocoder::getLocation($address);
  </code></pre>
  
  <p>every 8th geocoding, it pauses for a second then continues.. this seems to allow all geocoder locations to be rendered correctly... but it seems like a fluff.</p>
  
  <p>Any ideas?</p>