我从Google自动填充功能获得了地址,当我将地址放入Google Distance Matrix API(在浏览器中调用)时,我得到了No_Results。
{
"destination_addresses" : [ "대한민국 강원도 평창군 대관령면 130" ],
"origin_addresses" : [ "대한민국 서울특별시 강남구 삼성1동 영동대로 513" ],
"rows" : [
{
"elements" : [
{
"status" : "ZERO_RESULTS"
}
]
}
],
"status" : "OK"
}
我不确定是否因为 1)输入地址是韩文并且在韩国地区=>当我输入“华盛顿特区”和“纽约纽约”时,我得到了有效的结果
{
"destination_addresses" : [ "미국 뉴욕" ],
"origin_addresses" : [ "미국 워싱턴 DC 워싱턴" ],
"rows" : [
{
"elements" : [
{
"distance" : {
"text" : "362 km",
"value" : 361940
},
"duration" : {
"text" : "3시간 51분",
"value" : 13842
},
"status" : "OK"
}
]
}
],
"status" : "OK"
}
2)Lat,lng坐标在Google Distance Matrix API中的效果优于地址=>但是当我把相同韩国地址的lat,lng坐标放入时,它也不起作用。我从Google自动填充
获得了lat,lng坐标 var autocomplete = new google.maps.places.Autocomplete(input, options);
autocomplete.addListener('place_changed', function() {
var place = autocomplete.getPlace();
var placeGeo = place.geometry.location;
{
"destination_addresses" : [ "" ],
"origin_addresses" : [ "" ],
"rows" : [
{
"elements" : [
{
"status" : "NOT_FOUND"
}
]
}
],
"status" : "OK"
}
对于为什么会出现这种情况的任何想法?
答案 0 :(得分:1)
您获得ZERO_RESULTS的原因是因为默认情况下您的查询处于“mode = driving”状态,韩国不支持驾驶/步行/骑行路线。
https://developers.google.com/maps/coverage
目前在SK中支持的唯一模式是mode = transit,如果您将查询的次数减去:
您应该看到成功回应如下:
{
destination_addresses: [
"130 Daegwalnyeong-myeon, Pyeongchang-gun, Gangwon-do, South Korea"
],
origin_addresses: [
"513 Yeongdong-daero, Samseong 1(il)-dong, Gangnam-gu, Seoul, South Korea"
],
rows: [
{
elements: [
{
distance: {
text: "158 km",
value: 157837
},
duration: {
text: "12 hours 4 mins",
value: 43446
},
status: "OK"
}
]
}
],
status: "OK"
}