在表locs]下面的代码中,包括希腊不同地区的一些名称。对于每个区域,我调用graphicMap function通过Geocoding Service查找纬度和经度,并在地图上创建标记。
但是从索引12开始,之后显示错误。
请参见下面的结果:
错误:ΧΑΝΙΩΝ
确定:ΑΝΔΡΑΒΙΔΑΣ-ΚΥΛΛΗΝΗΣ
OK:ΒΕΡΟΙΑΣ
确定:ΑΒΔΗΡΩΝ
确定:ΑΧΑΡΝΩΝ
确定:ΑΣΤΥΠΑΛΑΙΑΣ
确定:ΡΕΘΥΜΝΗΣ
确定:ΓΑΛΑΤΣΙΟΥ
确定:ΔΕΛΦΩΝ
确定:ΒΕΛΒΕΝΤΟΥ
确定:ZΑΓΟΡΑΣ-ΜΟΥΡΕΣΙΟΥ
确定:ΒΕΛΟΥΒΟΧΑΣ
[例如,如果我删除记录ΑΧΑΡΝΩΝ
,则ΧΑΝΙΩΝ的值正常工作。Google是否已通过地理编码服务设置搜索限制?
这是因为我还没有购买API密钥吗?
提前感谢!
geocodeLatLong( JXMapContent , map , mapSet , graphic , graph , pins ){
/**
**** @procedure
**** Split and create table with the regions
**** Iterate table and find coordinates for each region
**/
var locs = JXMapContent.split( "," ) , u , length_table = locs.length;
for( u = 0; u < length_table; u++ )
{
graph( locs[ u ] , map , graphic , pins );
}
}
graphicMap( _location , map , graphic , pins ){
var geocoderRequest = {
address: _location
};
graphic.geocode( geocoderRequest, function(results, status) {
if (status === google.maps.GeocoderStatus.OK){
var marker = new google.maps.Marker({
map:map,
position : results[0].geometry.location,
icon:"images/marker.png",
animation:google.maps.Animation.DROP
});
pins.push( marker );
marker.addListener('click', function() {
for (var i = 0; i < pins.length; i++) {
pins[i].setAnimation(null);
}
if( this.getAnimation() !== null) {
this.setAnimation(null);
} else {
this.setAnimation(google.maps.Animation.BOUNCE);
}
});
console.log( "OK : " + _location );
}else{
console.log( "Error : " + _location );
}
});
}
在下面的表中的代码中,locs包括希腊不同地区的一些名称。对于每个区域,我调用graphicMap函数以通过Geocoding Service查找纬度和经度,并创建一个...
虽然您可以针对Google地图的地理编码服务进行的API调用中肯定会有限制,但您可能会查看返回的错误代码以了解发生了什么。