我尝试了苹果开发示例项目
http://developer.apple.com/library/ios/#samplecode/KMLViewer/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010046
它也可以很好地与URL配合使用,即http://maps.google.com/maps?saddr=source&daddr=destination&output=kml
但如果我将URL添加到目标中,则Google API无法正确生成KML输出
http://maps.google.com/maps?saddr=source&daddr=destination1%20to:destination2&output=kml
它仅为destination1生成KML
而网址
http://maps.google.com/maps?saddr=29.94,76.81&daddr=29.97,76.89%20to:30.38,76.77
http://maps.google.com/maps?saddr=29.94,76.81&daddr=30.38,76.77
显示正确的方向
任何想法如何生成正确的KML输出
或任何使用Google Direction API在MKMapkit中显示路径的好示例
最佳答案
&output = kml的KML在Google方面未作记录。您不应该依赖它。相反,您可以使用Google Directions Webservice并获取可以解析或转换为KML的JSON或XML。