簡體   English   中英

Google Direction API無法正常運作

[英]Google direction api not working correctly

我正在使用文本搜索和路線api的Java程序上工作,但是在某些情況下api無法正常工作。

例如:我必須在Hyundai Car Center,Sector 63, Noida附近搜索“ restaurants”。

為此,我使用了文本搜索API來獲取所需餐廳的格式化地址。 現在,當我使用direction api計算位置之間的最短時間和距離時,我沒有找到任何結果。

String addressFrom = "Mother Dairy, Bhim Nagri, Hauz Khas, New Delhi, India";
String addressTo = "Hyundai Car Center,Sector 63,Noida";
String urlString = "http://maps.googleapis.com/maps/api/directions/xml?sensor=true&origin="
                + addressFrom + "&destination=" + addressTo;
System.out.println(urlString);

我得到以下輸出:

http://maps.googleapis.com/maps/api/directions/xml?sensor=true&origin=Mother+Dairy%2C+Bhim+Nagri%2C+Hauz+Khas%2C+New+Delhi%2C+India&destination=Hyundai+Car+Center%2CSector+63%2CNoida
<?xml version="1.0" encoding="UTF-8"?>
<DirectionsResponse>
 <status>NOT_FOUND</status>
</DirectionsResponse>

問題是找不到“印度新德里豪茲·哈斯的比姆·納格里母親奶業”。 您可以通過在Google Geocoder示例頁面中一次輸入一個端點來測試是否可以找到這些端點。

但是, 可以找到“印度新德里Hauz Khas的Bhim Nagri”,並且非常接近地圖上標有“母親乳業”的位置。

暫無
暫無

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

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