KMLSaxParser 0.1.2

KMLSaxParser 0.1.2

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Apr 2016

Maintained by Nick Blackwell.



  • By
  • nickolanack

An ultra simple SAX kml parser - great for large kml files

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Blocks Methos

#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];

}



Delegate Method

#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
}
...

Requirements

Installation

KMLSaxParser is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "KMLSaxParser"

Author

nickolanack, [email protected]

License

KMLSaxParser is available under the MIT license. See the LICENSE file for more info.