Open WPS Platform

ZOO.Format.KML

Read/Write KML.

Inherits from

Properties and Functions

NAME DESCRIPTION
kmlns {String} KML Namespace to use.
foldersName {String} Name of the folders.
foldersDesc {String} Description of the folders.
placemarksDesc {String} Name of the placemarks.
extractAttributes {Boolean} Extract attributes from KML.
ZOO.Format.KML Create a new parser for KML.
parseFeatures Loop through all Placemark nodes and parse them.
parseFeature This function is the core of the KML parsing code in ZOO.
parseGeometry Properties of this object are the functions that parse geometries based on their type.
parseGeometry.point Given a KML node representing a point geometry, create a ZOO point geometry.
parseGeometry.linestring Given a KML node representing a linestring geometry, create a ZOO linestring geometry.
parseGeometry.polygon Given a KML node representing a polygon geometry, create a ZOO polygon geometry.
parseGeometry.multigeometry Given a KML node representing a multigeometry, create a ZOO geometry collection.
parseAttributes  
parseExtendedData Parse ExtendedData from KML.
write Accept Feature Collection, and return a string.
createPlacemark Creates and returns a KML placemark node representing the given feature.
buildGeometryNode Builds and returns a KML geometry node with the given geometry.
buildGeometry Object containing methods to do the actual geometry node building based on geometry type.
buildGeometry.point Given a ZOO point geometry, create a KML point.
buildGeometry.multipoint Given a ZOO multipoint geometry, create a KML GeometryCollection.
buildGeometry.linestring Given a ZOO linestring geometry, create a KML linestring.
buildGeometry.multilinestring Given a ZOO multilinestring geometry, create a KML GeometryCollection.
buildGeometry.linearring Given a ZOO linearring geometry, create a KML linearring.
buildGeometry.polygon Given a ZOO polygon geometry, create a KML polygon.
buildGeometry.multipolygon Given a ZOO multipolygon geometry, create a KML GeometryCollection.
buildGeometry.collection Given a ZOO geometry collection, create a KML MultiGeometry.
buildCoordinatesNode Builds and returns the KML coordinates node with the given geometry <coordinates>...</coordinates>
kmlns
{String} KML Namespace to use. Defaults to 2.2 namespace.
foldersName
{String} Name of the folders. Default is “ZOO export”. If set to null, no name element will be created.
foldersDesc
{String} Description of the folders. Default is “Exported on [date].” If set to null, no description element will be created.
placemarksDesc
{String} Name of the placemarks. Default is “No description available”.
extractAttributes
{Boolean} Extract attributes from KML. Default is true. Extracting styleUrls requires this to be set to true
ZOO.Format.KML

Create a new parser for KML.

Parameters

options {Object} An optional object whose properties will be set on this instance.

parseFeatures
parseFeatures: function(nodes)

Loop through all Placemark nodes and parse them. Will create a list of features

Parameters

nodes {Array} of {E4XElement} data to read/parse.
options {Object} Hash of options
parseFeature
parseFeature: function(node)

This function is the core of the KML parsing code in ZOO. It creates the geometries that are then attached to the returned feature, and calls parseAttributes() to get attribute data out.

Parameters

node {E4XElement}

Returns

{ZOO.Feature} A vector feature.

parseGeometry
Properties of this object are the functions that parse geometries based on their type.
parseGeometry.point

Given a KML node representing a point geometry, create a ZOO point geometry.

Parameters

node {E4XElement} A KML Point node.

Returns

{ZOO.Geometry.Point} A point geometry.

parseGeometry.linestring

Given a KML node representing a linestring geometry, create a ZOO linestring geometry.

Parameters

node {E4XElement} A KML LineString node.

Returns

{ZOO.Geometry.LineString} A linestring geometry.

parseGeometry.polygon

Given a KML node representing a polygon geometry, create a ZOO polygon geometry.

Parameters

node {E4XElement} A KML Polygon node.

Returns

{ZOO.Geometry.Polygon} A polygon geometry.

parseGeometry.multigeometry

Given a KML node representing a multigeometry, create a ZOO geometry collection.

Parameters

node {E4XElement} A KML MultiGeometry node.

Returns

{ZOO.Geometry.Collection} A geometry collection.

parseAttributes
parseAttributes: function(node)

Parameters

node {E4XElement}

Returns

{Object} An attributes object.

parseExtendedData
parseExtendedData: function(node)

Parse ExtendedData from KML. Limited support for schemas/datatypes. See http://code.google.com/apis/kml/documentation/kmlreference.html#extendeddata for more information on extendeddata.

Parameters

node {E4XElement}

Returns

{Object} An attributes object.

write
write: function(features)

Accept Feature Collection, and return a string.

Parameters

features {Array(ZOO.Feature)} An array of features.

Returns

{String} A KML string.

createPlacemark
createPlacemark: function(feature)

Creates and returns a KML placemark node representing the given feature.

Parameters

feature {ZOO.Feature}

Returns

{E4XElement}

buildGeometryNode
buildGeometryNode: function(geometry)

Builds and returns a KML geometry node with the given geometry.

Parameters

geometry {ZOO.Geometry}

Returns

{E4XElement}

buildGeometry
Object containing methods to do the actual geometry node building based on geometry type.
buildGeometry.point

Given a ZOO point geometry, create a KML point.

Parameters

geometry {ZOO.Geometry.Point} A point geometry.

Returns

{E4XElement} A KML point node.

buildGeometry.multipoint

Given a ZOO multipoint geometry, create a KML GeometryCollection.

Parameters

geometry {ZOO.Geometry.MultiPoint} A multipoint geometry.

Returns

{E4XElement} A KML GeometryCollection node.

buildGeometry.linestring

Given a ZOO linestring geometry, create a KML linestring.

Parameters

geometry {ZOO.Geometry.LineString} A linestring geometry.

Returns

{E4XElement} A KML linestring node.

buildGeometry.multilinestring

Given a ZOO multilinestring geometry, create a KML GeometryCollection.

Parameters

geometry {ZOO.Geometry.MultiLineString} A multilinestring geometry.

Returns

{E4XElement} A KML GeometryCollection node.

buildGeometry.linearring

Given a ZOO linearring geometry, create a KML linearring.

Parameters

geometry {ZOO.Geometry.LinearRing} A linearring geometry.

Returns

{E4XElement} A KML linearring node.

buildGeometry.polygon

Given a ZOO polygon geometry, create a KML polygon.

Parameters

geometry {ZOO.Geometry.Polygon} A polygon geometry.

Returns

{E4XElement} A KML polygon node.

buildGeometry.multipolygon

Given a ZOO multipolygon geometry, create a KML GeometryCollection.

Parameters

geometry {ZOO.Geometry.Point} A multipolygon geometry.

Returns

{E4XElement} A KML GeometryCollection node.

buildGeometry.collection

Given a ZOO geometry collection, create a KML MultiGeometry.

Parameters

geometry {ZOO.Geometry.Collection} A geometry collection.

Returns

{E4XElement} A KML MultiGeometry node.

buildCoordinatesNode
buildCoordinatesNode: function(geometry)

Builds and returns the KML coordinates node with the given geometry <coordinates>...</coordinates>

Parameters

geometry {ZOO.Geometry}

Return

{E4XElement}