经度 - 纬度地址的OVER_QUERY_LIMIT错误 [英] OVER_QUERY_LIMIT error with latitude-longitude addresses
问题描述
谷歌地图API v3
Google maps API v3
我想在地图上绘制大约500-600个针脚。我收到OVER_QUERY_LIMIT错误。如果我mannualy将数据库中的addreses地理编码为lat / long,这有什么关系吗?这是一种避免2500每天的查询限制的方法,因为没有地址经纬度/长翻译将被做?
I would like to plot about 500-600 pins on the map. I am getting OVER_QUERY_LIMIT error. Does it matter if I mannualy geocode the addreses in the database to lat/long? Is this a way to avoid the query limit of 2500 per day, since no address to lat/long translation will be made?
这是我使用的代码
Blockquote
Blockquote
<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);
}
});
}
推荐答案
对数据库中的地址进行地理编码。这是我个人总是在需要这些信息时所采取的方法,因为您只需要进行一次地理编码,直到他们更新地址。它会更快,更高效。
It matters not if you manually geocode the addresses in the database. It's the approach I've personally always taken when needing this information as you only want to geocode once, until they update their address. It will be quicker and more efficient.
这篇关于经度 - 纬度地址的OVER_QUERY_LIMIT错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!