Extending iOS KMLViewer Sample to Handle KML NetworkLink Elements

谁说我不能喝 提交于 2019-12-22 12:32:26

问题


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.


回答1:


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.


来源:https://stackoverflow.com/questions/5248021/extending-ios-kmlviewer-sample-to-handle-kml-networklink-elements

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!