在 iphone 应用程序中生成 KML 文件 [英] Generate KML file within iphone app

查看:36
本文介绍了在 iphone 应用程序中生成 KML 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我必须在 MKAnnotation 和 MKOverlay 类的帮助下在 MKMapView 中绘制用户位置和目标位置之间的路线.我已经阅读了苹果的 KMLViewer 示例代码,他们提到在编程步骤之外创建 KML 文件,但我需要在 iPhone 应用程序编程中生成 KML 文件.

In my app i have to draw route between user location and destination location in MKMapView with help of MKAnnotation and MKOverlay classes. I had gone through the KMLViewer sample code from apple in there they mentioned to create KML file outside the programming steps, but i need KML file generation inside iPhone app programming.

有可能吗?我需要帮助来做这件事..

is it possible? and i need help on doing that..

手动获取 KML 文件的步骤

获取KML的过程如下:

The process to obtain a KML is as follows:

  • 转到:http://maps.google.com/"
  • 点击获取路线"链接
  • 输入起始地址和目标地址(例如)起点 = 451 University Avenue, Palo Alto, CA 94301目的地 = #1 Infinite Loop, Cupertino, CA 95014
  • 根据需要修改路线.
  • 点击此页面链接的链接".
  • 复制电子邮件/即时消息链接.
  • 将该链接粘贴回 Safari 的地址栏中.
  • 将 &output=kml 添加到 url 的末尾,然后按 Enter 键.
  • KML 文件将下载到您的下载文件夹.
  • Go to: "http://maps.google.com/"
  • Click "Get Directions" link
  • Type in the start and destination addresses (for example) Start = 451 University Avenue, Palo Alto, CA 94301 Destination = #1 Infinite Loop, Cupertino, CA 95014
  • Modify the route as you wish.
  • Click the "Link" to this page link.
  • Copy the email/IM link.
  • Paste the link back into your Safari's address bar.
  • Add &output=kml to the end of the url and press the enter key.
  • The KML file will be downloaded to your Downloads folder.

但我需要以编程方式完成...

but i need this to be done programmatically...

推荐答案

KML 只是 XML,在 Cocoa 中有多种生成 XML 文件的方法,例如使用 KissXML.

KML is just XML and there are various methods for generating XML files in Cocoa, e.g. using KissXML.

此处记录了 KML 格式:http://code.google.com/apis/kml/documentation/kmlreference.html.

The KML format is documented here: http://code.google.com/apis/kml/documentation/kmlreference.html.

这篇关于在 iphone 应用程序中生成 KML 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆