google map v3 OVER_QUERY_LIMIT - Geocoding with PHP MYSQL -
i having error of over_query_limit in using google maps api v3. want add markers database geocoding. if use limit in sql query markers shown, if increase limit greater 10 showing error.
<?php mysql_connect('localhost','root','') or die(mysql_error()); mysql_select_db('dbname') or die(mysql_error()); $result = mysql_query("select * deal cityid=44 limit 10") or die(mysql_error()); $count = 0; echo mysql_num_rows($result); $row = mysql_fetch_array($result);
?>
<script type="text/javascript"> var geocoder; var map; //var address; function initialize() { geocoder = new google.maps.geocoder(); var latlng = new google.maps.latlng(34.052234,-118.243685); var address = "<?php echo $row['address']; ?>"; //address = '3655 south durango, las vegas, nv 89147'; //alert(address); var myoptions = { zoom: 14, center: latlng, maptypeid: google.maps.maptypeid.roadmap } map = new google.maps.map(document.getelementbyid("map_canvas"), myoptions); <?php while($row = mysql_fetch_array($result)){ ?> geocoder.geocode( { 'address': "<?php echo $row['address']; ?>"}, function(results, status) { if (status == google.maps.geocoderstatus.ok) { map.setcenter(results[0].geometry.location); var marker = new google.maps.marker({ map: map, position: results[0].geometry.location }); var contentstring = '<div id="content">'+ '<div id="sitenotice">'+ '</div>'+ "<h1 id='firstheading' class='firstheading'><?php echo $row['businessname']; ?></h1>"+ '<div id="bodycontent">'+ "<p><?php echo $row['longdesc']; ?></p>"+ '<p>attribution: uluru, <a href="#">'+ 'click see</a> '+ '</div>'+ '</div>'; var infowindow = new google.maps.infowindow({ content: contentstring }); google.maps.event.addlistener(marker, 'click', function() { infowindow.open(map,marker); }); <?php sleep(1); ?> } else { alert("geocode not successful following reason: " + status); //settimeout("wait = true", 2000); } }); <?php } ?> } google.maps.event.adddomlistener(window, 'load', initialize); </script>
you can't geocode more 2500 locations per day free version. based on memories, have wait approximatively 0.5 seconds between 2 geocods, must delay script ; else you'll blocked.
Comments
Post a Comment