This is a iOS framework for parsing/generating KML files. This Framework parses the KML from a URL or Strings and create Objective-C Instances of KML structure.
-
Install the iOS Universal Framework.
-
Open up the KML project (KML.xcodeproj) in Xcode 4.
-
Click Product > Build in the menu bar.
Drag the framework file into the project's Frameworks group, and import the header file.
#import <KML/KML.h>
To parsing the KML file, simply call the parse method :
KMLRoot *root = [KMLParser parseKMLWithString:kml];
You can generate the KML :
KMLRoot *root = [KMLRoot new];
KMLDocument *doc = [KMLDocument new];
root.feature = doc;
KMLPlacemark *placemark = [KMLPlacemark new];
placemark.name = @"Simple placemark";
placemark.descriptionValue = @"Attached to the ground.";
[doc addFeature:placemark];
KMLPoint *point = [KMLPoint new];
placemark.geometry = point;
KMLCoordinate *coordinate = [KMLCoordinate new];
coordinate.latitude = 37.422f;
coordinate.longitude = -122.082f;
point.coordinate = coordinate;
TBXML Copyright (c) 2009 Tom Bradley