- Google KML Reader/Writer
- Google KML Quick Facts
- Resource Traversal
- Google KML Reader Parameters
- Google KML Writer Parameters
- KML Writer Feature Type Properties: Format Parameters
- Writer Pipelines
- Atom Metadata
- Style Management and Common Styles
- Document Element Omission
- Raw Text
- Update Mode
- Feature Representation
- KML Dataset Structure
- File Structure
- Identifying Elements
- Documents and Folders
- Tours
- Extended Data
- User Defined Schema
- Layers and Feature Type Fanout
- Feature Attributes
- Geometry
- 3D
- Fixed Schema
- Common Element Attributes
- Common Format Attributes
- NetworkLinkControl
- Document
- Folder
- Placemark
- ScreenOverlay
- GroundOverlay
- PhotoOverlay
- NetworkLink
- Style
- StyleMap
- Tour
- AnimatedUpdate
- FlyTo
- SoundCue
- TourControl
- Wait
User Defined Schema
In addition to the fixed schema, and explicit definition of extended data, the KML reader and writer also provide automatic support for user-defined schema.
Reader
The KML reader supports reading KML datasets that use KML 2.0, 2.1, or 2.2 schema declarations.
Upon opening a KML dataset, the KML reader will attempt to scan the dataset's schema by reading all the Schema elements in the file, and traversing all schemaUrl and NetworkLink references in the file. The default schema scanning behavior can be disabled with the SCAN_SCHEMA reader directive.
If Schema declarations are found, the associated Placemark elements will be read as user-defined feature types with the associated set of user-defined attributes. In addition to the user-defined attributes, the kml_data and kml_schema_data structured list attributes will be created as necessary.
Writer
The KML writer only supports writing KML 2.2 schema elements. Older style schema formats have been deprecated, and are not well supported by applications other than Google Earth.
The KML writer creates the appropriate <Schema> elements for each user-defined featuretype; each feature is written as either a Placemark or GroundOverlay depending on the feature's geometry type. This behavior can be disabled using the OUTPUT_SCHEMA writer directive.
When writing large, multi-file datasets, it is useful to be able to store the schema data in an external file. The KML writer allows the filename of an external schema file to be specified using the SCHEMA_DOC directive.
Note: The value must be a filename including the "kml" extension, and will be overwritten during the translation. The schemaUrl attributes of each <SchemaData> element will be adjusted to point to the external file.