繁体   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