Read/Write KML.
Inherits from
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> |
Create a new parser for KML.
Parameters
options {Object} An optional object whose properties will be set on this instance.
parseFeatures: function(nodes)
Loop through all Placemark nodes and parse them. Will create a list of features
Parameters
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.
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.
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.
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.
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: function(node)
Parameters
node {E4XElement}
Returns
{Object} An attributes object.
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: function(features)
Accept Feature Collection, and return a string.
Parameters
features {Array(ZOO.Feature)} An array of features.
Returns
{String} A KML string.
createPlacemark: function(feature)
Creates and returns a KML placemark node representing the given feature.
Parameters
feature {ZOO.Feature}
Returns
{E4XElement}
buildGeometryNode: function(geometry)
Builds and returns a KML geometry node with the given geometry.
Parameters
geometry {ZOO.Geometry}
Returns
{E4XElement}
Given a ZOO point geometry, create a KML point.
Parameters
geometry {ZOO.Geometry.Point} A point geometry.
Returns
{E4XElement} A KML point node.
Given a ZOO multipoint geometry, create a KML GeometryCollection.
Parameters
geometry {ZOO.Geometry.MultiPoint} A multipoint geometry.
Returns
{E4XElement} A KML GeometryCollection node.
Given a ZOO linestring geometry, create a KML linestring.
Parameters
geometry {ZOO.Geometry.LineString} A linestring geometry.
Returns
{E4XElement} A KML linestring node.
Given a ZOO multilinestring geometry, create a KML GeometryCollection.
Parameters
geometry {ZOO.Geometry.MultiLineString} A multilinestring geometry.
Returns
{E4XElement} A KML GeometryCollection node.
Given a ZOO linearring geometry, create a KML linearring.
Parameters
geometry {ZOO.Geometry.LinearRing} A linearring geometry.
Returns
{E4XElement} A KML linearring node.
Given a ZOO polygon geometry, create a KML polygon.
Parameters
geometry {ZOO.Geometry.Polygon} A polygon geometry.
Returns
{E4XElement} A KML polygon node.
Given a ZOO multipolygon geometry, create a KML GeometryCollection.
Parameters
geometry {ZOO.Geometry.Point} A multipolygon geometry.
Returns
{E4XElement} A KML GeometryCollection node.
Given a ZOO geometry collection, create a KML MultiGeometry.
Parameters
geometry {ZOO.Geometry.Collection} A geometry collection.
Returns
{E4XElement} A KML MultiGeometry node.
buildCoordinatesNode: function(geometry)
Builds and returns the KML coordinates node with the given geometry <coordinates>...</coordinates>
Parameters
geometry {ZOO.Geometry}
Return
{E4XElement}