KMLSaxParser 0.1.2

KMLSaxParser 0.1.2

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布日期最后发布日期2016年4月

Nick Blackwell 维护。



  • By
  • nickolanack

一个超简单的 SAX kml 解析器 - 非常适合处理大型 kml 文件

用法

要运行示例项目,首先克隆存储库,然后从示例目录运行 pod install

块方法

#import "Kml.h"

//...

-(void) someKmlIntializer:(NSString *) kmlText{


NSString *kmlString=@"<?xml version=\"1.0\" encoding=\"UTF-8\"?><kml xmlns=\"http:/www.opengis.net/kml/2.2\"><Placemark><name>Descriptive HTML</name><visibility>1</visibility><description><![CDATA[]]></description><Point><coordinates>-122.0822035425683,37.42228990140251,0</coordinates></Point></Placemark></kml>​";

    Kml *kml =[[Kml alloc] initWithKmlString:kmlString];

    [kml onPlacemark:^(NSDictionary *dictionary) {

        //NSLog(@"%@", dictionary);

    }];

    [kml parse];

}



代理方法

#SomeViewController.h 

...
#import "SaxKmlParserDelegate.h"
@interface SomeViewController : UIViewController<SaxKmlParserDelegate, ...>
...




#SomeViewController.m

...

-(void) someKmlIntializer:(NSString *) kmlText{

     [[[SaxKmlParser alloc] initWithDelegate:self] parseString:kmlText];

}
-(void) onKmlPlacemark:(NSDictionary *)dictionary{
    //TODO add to MKMap
}
-(void) onKmlGroundOverlay:(NSDictionary *)dictionary{
    //TODO add to MKMap
}
-(void) onKmlPolyline:(NSDictionary *)dictionary{
    //TODO add to MKMap
}
-(void) onKmlPolygon:(NSDictionary *)dictionary{
    //TODO add to MKMap
}
...

要求

安装

KMLSaxParser 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中

pod "KMLSaxParser"

作者

nickolanack,[email protected]

许可证

KMLSaxParser 使用 MIT 许可证提供。有关更多信息,请参阅 LICENSE 文件。