簡體   English   中英

緯度-經度地址出現OVER_QUERY_LIMIT錯誤

[英]OVER_QUERY_LIMIT error with latitude-longitude addresses

Google Maps API v3

我想在地圖上繪制約500-600針。 我收到OVER_QUERY_LIMIT錯誤。 如果我手動將數據庫中的地址地理編碼為經/緯度,那有關系嗎? 這是一種避免每天查詢限制為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);
        }
    });
}

如果您手動對數據庫中的地址進行地理編碼,則無關緊要。 我只需要對地址進行一次地理編碼,直到他們更新地址,這就是我個人經常需要此信息時采用的方法。 它將更快,更高效。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM