【发布时间】:2012-01-22 08:11:06
【问题描述】:
首先我需要谷歌地图api,找到2点之间的路线并输出。 我只在 json 和 xml 输出中看到方向请求输出。我没有看到 kml。
http://code.google.com/apis/maps/documentation/directions/
http://maps.googleapis.com/maps/api/directions/json 这行得通!
http://maps.googleapis.com/maps/api/directions/kml这不起作用!
Apple 的 KMLViewer 采用 KML 文件并将路线以颜色绘制为覆盖在谷歌地图上。
http://developer.apple.com/library/ios/#samplecode/KMLViewer/Introduction/Intro.html
我打算在 Iphone 上使用 Apple 的 KMLViewer 作为显示器。但它需要 KML 文件。
但是,Google Map api 不输出 KML 文件。
我应该如何处理这个问题?
【问题讨论】:
-
你读过KMLViewer项目中的ReadMe.txt file吗?
Add &output=kml to the end of the url部分不起作用吗? -
不,maps.googleapis.com/maps/api/directions/json? { "routes" : [], "status" : "REQUEST_DENIED" } 但如果尝试 kml,maps.googleapis.com/maps/api/directions/kml? 404. 这是一个错误。在此服务器上未找到请求的 URL /maps/api/directions/kml。这就是我们所知道的。
-
确保您完全按照自述文件中的步骤进行操作。然后你会得到一个这样的网址:
http://maps.google.com/maps?saddr=451+University+Avenue,+Palo+Alto,+CA+94301&daddr=1+Infinite+Loop,+Cupertino,+CA+95014&output=kml -
好的,为什么你的例子中的文件 kml 是空的?我下载了那个kml文件,里面什么都没有。
-
不知何故,
&da和ddr之间出现了一个空格。无论如何,请完全按照这些步骤操作。试试this
标签: iphone google-maps-api-3 kml