0
我有一個數組,座標(緯度,經度)... 這個數組約60-80項...爲什麼Geocoder谷歌不想承認更多的地址?
在我的foreach循環有...
...{
$lat = substr($xx[1],0,8);
$long = substr($xx[0],0,8);
?>
<script type="text/javascript">
// <![CDATA[
$(function() {
var geocoder = new google.maps.Geocoder();
function geocodePosition(pos,pos2) {
geocoder.geocode({
latLng: new google.maps.LatLng(pos,pos2)
}, function(responses) {
if (responses && responses.length > 0) {
console.log(responses[0].formatted_address);
} else {
console.log('Cannot determine address at this location.');
}
});
}
geocodePosition(<?php echo $lat ?>,<?php echo $long ?>);
});
// ]]>
</script>
<?php } ...
地理編碼地理編碼在最多5個座標處,其他人會輸出'無法確定此位置的地址。'
當我採取了一些「無法確定」,我手動使用它們(只是1項= lat和長,而不是整個數組)它的工作原理。
那麼問題在哪裏呢?
我把JS的開始要求每天只有2500地址基本的API,與業務函數:setTimeout(function(){},300); ,並在php循環中休眠(300)。仍然不起作用 – user1666761
嘗試2秒(2000) –
我用它約1秒(1000)之前循環200地址,它的工作。 –