2013-06-29 62 views
0

Google maps API v3OVER_QUERY_LIMIT有经纬度地址的错误

我想在地图上绘制大约500-600个针脚。我收到OVER_QUERY_LIMIT错误。如果我mannualy将数据库中的addreses地理编码为lat/long,这有什么关系吗?这是一种避免每天2500个查询限制的方法,因为没有经纬度/长整型翻译的地址?

这是我用

块引用

<script src="http://maps.googleapis.com/maps/api/js?sensor=false"  type="text/javascript"></script> 
<script src="http://google-maps-utility-library-v3.googlecode.com/svn/tags/infobox/1.1.9/src/infobox_packed.js" type="text/javascript"></script>  
<style type="text/css"> #ppt-object-map { height:<?php echo $h; ?>px; width:<?php echo $w; ?>px; }</style> 
<script type="text/javascript"> 

function initialize() { 
var myOptions = { zoom: <?php echo get_option("ppt_object_map_zoom"); ?>, center: new  google.maps.LatLng(44.69,-63.62), mapTypeId: google.maps.MapTypeId.ROADMAP } 
var map = new google.maps.Map(document.getElementById("ppt-object-map"), myOptions); setMarkers(map, featuredlistings); 
} 
var featuredlistings = [ 
<?php 
if(!empty($postslist)){ $i=1; 
foreach($postslist as $post){ 
$map = trim(strip_tags((get_post_meta($post->ID, 'map_location', true)))); 
if(strlen($map) > 5){ 
echo "['".addslashes(str_replace("-"," ",$post->post_title)).premiumpress_image($post- >ID,"",array('alt' => $post->post_title, 'link' => true, 'width' => '120', 'height' => '100', 'style' => 'auto'))."', '".get_post_meta($post->ID, 'map_location', true)."', ".$i."],"; $i++; } } } 
?> 
]; 
function setMarkers(map, locations) { 
for (var i = 0; i < locations.length; i++) { 
var featuredlistings = locations[i]; 
DrawIcon(map,featuredlistings); 
} 
} 
function DrawIcon(map,featuredlistings){ 
var image = new google.maps.MarkerImage('<?php echo PPT_FW_JS_URI; ?>/map/icon.png', 
new google.maps.Size(20, 32), 
new google.maps.Point(0,0), 
new google.maps.Point(0, 32)); 
var shadow = new google.maps.MarkerImage('<?php echo PPT_FW_JS_URI; ?>/map/shadow.png', 
new google.maps.Size(37, 32), 
new google.maps.Point(0,0), 
new google.maps.Point(0, 32)); 
var image = "<?php echo PPT_FW_JS_URI; ?>map/iconx.png"; 
var shadow = "<?php echo PPT_FW_JS_URI; ?>map/shadow.png"; 
var shape = { 
coord: [1, 1, 1, 20, 18, 20, 18 , 1], 
type: 'poly' 
}; 
geocoder = new google.maps.Geocoder(); 
geocoder.geocode({ 'address': featuredlistings[1] }, function(results, status) { 
if (status == google.maps.GeocoderStatus.OK) { 
map.setCenter(results[0].geometry.location); 
var marker = new google.maps.Marker({ 
shadow: shadow, 
icon: image, 
map: map, 
position: results[0].geometry.location, 
}); 
var boxText = document.createElement("div"); 
if(featuredlistings[0].length > 20){ 
var maph = -80; 
var mapw = -160 
boxText.style.cssText = "margin-top: 8px; background: #000000; padding: 5px; -moz- border-radius: 3px; border-radius: 3px; font-size:12px; font-weight:bold; color:#fff; padding-bottom:10px;"; 
} else{ 
var maph = -80; 
var mapw = -70 
boxText.style.cssText = "margin-top: 8px; background: #000000; padding: 5px; -moz- border-radius: 3px; border-radius: 3px; font-size:12px; font-weight:bold; color:#fff;"; 
} 
boxText.innerHTML = "<div class='map_container'>"+featuredlistings[0]+"</div>"; 
var myOptions = { 
content: boxText 
,disableAutoPan: false 
,maxWidth: 0 
,pixelOffset: new google.maps.Size(maph, mapw) 
,zIndex: null 
,boxStyle: { 
opacity: 0.8 
,width: "160px" 
} 
,closeBoxMargin: "10px 2px 2px 2px" 
,closeBoxURL: "<?php echo PPT_FW_JS_URI; ?>/map/close.png" 
,infoBoxClearance: new google.maps.Size(1, 1) 
,isHidden: false 
,pane: "floatPane" 
,enableEventPropagation: true 
}; 
google.maps.event.addListener(marker, 'mouseover', function(e) { ib.open(map, marker);  }); 
google.maps.event.addListener(marker, "click", function (e) { ib.open(map, this); }); 
var ib = new InfoBox(myOptions); 
    } else { 
      alert("Geocode was not successful for the following reason: " +  status); 
     } 
    }); 
} 
+0

你可以使用经纬度对免费画一个PIN ... – dandavis

+0

我mannualy geocoded经纬度对经纬度对,但我仍然收到OVER_QUERY_LIMIT错误。即使是经纬度对,我是否每秒限制在10个QUERYS? – user2533989

+0

如果您知道可见地图角落的纬度/经度,则可以在地图图像上一次绘制500个自己。我使用了一个Google js库,它可以让你做同样的事情:在没有任何网络连接的情况下绘制一个别针。 – dandavis

回答

0

重要的不是,如果你手动地理编码地址在数据库中的代码。这是我个人总是在需要这些信息时所采取的方法,因为您只需要进行一次地理编码,直到他们更新地址。它会更快,更高效。