本文介绍了Google Directions API 和 Using maps.google.com 给出不同的响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里 - > https://maps.google.com/我查询了参数A : antim chauraha,印多尔,中央邦,印度B : India Collection, Indore, Madhya Pradesh, India

Here - > https://maps.google.com/I queried for parameters A : antim chauraha, Indore, Madhya Pradesh, IndiaB : India Collection, Indore, Madhya Pradesh, India

并使用 webservice 获取 XML,来自 Direction API 的相同响应

And using the webservice to get as XML, same response from Direction API

http://maps.googleapis.com/maps/api/directions/xml?origin=ANTIM%20CHAURAHA,Indore,Madhya%20Pradesh,India&destination=INDIA%20COLLECTION,PALSIKAR,Indore,Madhya%20Pradesh,India&sensor=false

这些响应根本不匹配.你会看到距离、方向或任何东西.

Those responses do not match at all. You see the distance, direction or anything.

我做错了什么吗?

推荐答案

Google 地图 使用附加信息来定位您的请求参数".路线 API 使用邮政地址(大部分情况下).

Google Maps uses additional information to locate your "query string". The directions API uses postal addresses (for the most part).

这些看起来都不是一个特别好的地址"A : antim chauraha,印多尔,中央邦,印度B : India Collection, Indore, Madhya Pradesh, India

Neither of these looks like a particularly good "address"A : antim chauraha, Indore, Madhya Pradesh, India B : India Collection, Indore, Madhya Pradesh, India

通过 Google Maps API v3 地理编码器运行它们,它们都解析到同一个地方(印度中央邦印多尔)

Run them through the Google Maps API v3 geocoder, they both resolve to the same place (Indore, Madhya Pradesh, India)

如果您需要像这样解析地点",请使用 Places API 获取坐标,然后使用路线服务获取坐标之间的路线.

If you need to resolve "places" like that, use the Places API to get coordinates, then use the directions service to get directions between the coordinates.

这篇关于Google Directions API 和 Using maps.google.com 给出不同的响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 19:22