扩展 iOS KMLViewer 示例以处理 KML NetworkLink 元素

发布于 2024-10-20 22:48:07 字数 545 浏览 4 评论 0原文

我正在开发一个通过 MKMapView 显示 KML 数据的 iOS 应用程序。

Apple 的 KMLViewer 示例应用程序已经帮助我开始了。不幸的是,我使用的 KML 数据严重依赖于通过 NetworkLinkLinkhref KML 元素链接的文件,而 KMLViewer 的解析器则不这样做。处理那些。

我可能可以弄清楚如何添加此类支持,但在我走这条路之前,我想知道是否有其他人已经这样做了,或者是否有比 KMLViewer 更好的起点。

我查看了 Simple KML,但它似乎不支持 NetworkLink< /代码> 要么。

I am developing an iOS app that displays KML data over an MKMapView.

Apple's KMLViewer sample app has gotten me started. Unfortunately, the KML data I am using relies heavily on linked files via the NetworkLink, Link and href KML elements, and KMLViewer's parser doesn't handle those.

I can probably figure out how to add such support, but before I go down that road I was wondering if anyone else has already done this, or if there is a better starting point than KMLViewer.

I've looked at Simple KML, but it doesn't seem to support NetworkLink either.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

万劫不复 2024-10-27 22:48:07

我的调查过程如下:

  1. 我首先扩展了 KMLViewer 示例以支持我需要的其他元素。该示例不太适合这种情况:它没有按照 SAX 样式解析器应有的方式组织,并且如果您想向其中添加更多内容,那么简单的状态机确实需要彻底修改。
  2. 接下来我尝试了 Simple KML 库。它很容易使用,但是解析我需要解析的 KML 文件需要 3500 毫秒,这比我认为可以接受的时间至少长了 3000 毫秒。此外,Simple KML 并不支持我需要的所有元素和属性,因此如果我想使用它,我需要扩展它。
  3. 所以,我最终只使用了 TBXML,它很容易使用,并且在不到 100 毫秒的时间内解析了文件。

Here's how my investigations went:

  1. I first extended the KMLViewer sample to support the additional elements I needed. The sample is not well suited to this: it is not organized the way a SAX-style parser should be, and the simplistic state machine really needs an overhaul if you want to add more stuff to it.
  2. Next I tried the Simple KML library. It was easy to use, but it took 3500 milliseconds to parse the KML file I needed to parse, which was at least 3000 milliseconds longer than I would find acceptable. Also, Simple KML didn't support all the elements and attributes I needed, so I would have needed to extend it if I wanted to use it.
  3. So, I finally just used TBXML, which was easy to use and which parsed the file in less than 100 milliseconds.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文