Read/write GPX parser. Create a new instance with the OpenLayers.Format.GPX constructor.
OpenLayers. | Read/write GPX parser. |
Properties | |
defaultDesc | {String} Default description for the waypoints/tracks in the case where the feature has no “description” attribute. |
extractWaypoints | {Boolean} Extract waypoints from GPX. |
extractTracks | {Boolean} Extract tracks from GPX. |
extractRoutes | {Boolean} Extract routes from GPX. |
extractAttributes | {Boolean} Extract feature attributes from GPX. |
namespaces | {Object} Mapping of namespace aliases to namespace URIs. |
schemaLocation | {String} Schema location. |
creator | {String} The creator attribute to be added to the written GPX files. |
Constructor | |
OpenLayers. | Create a new parser for GPX. |
Functions | |
read | Return a list of features from a GPX doc |
extractSegment | |
parseAttributes | |
write | Accepts Feature Collection, and returns a string. |
buildMetadataNode | Creates a “metadata” node. |
buildFeatureNode | Accepts an OpenLayers.Feature.Vector, and builds a node for it. |
buildTrkSegNode | Builds trkseg node(s) given a geometry |
buildTrkPtNode | Builds a trkpt node given a point |
buildWptNode | Builds a wpt node given a point |
appendAttributesNode | Adds some attributes node. |
{String} Schema location. Defaults to “http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd”
read: function( doc )
Return a list of features from a GPX doc
doc | {Element} |
Array({OpenLayers.Feature.Vector})
extractSegment: function( segment, segmentType )
segment | {DOMElement} a trkseg or rte node to parse |
segmentType | {String} nodeName of waypoints that form the line |
{OpenLayers.Geometry.LineString} A linestring geometry
write: function( features, metadata )
Accepts Feature Collection, and returns a string.
features | {Array(OpenLayers.Feature.Vector)} List of features to serialize into a string. |
metadata | {Object} A key/value pairs object to build a metadata node to add to the gpx. Supported keys are ‘name’, ‘desc’, ‘author’. |
buildFeatureNode: function( feature )
Accepts an OpenLayers.Feature.Vector, and builds a node for it.
feature | {OpenLayers.Feature.Vector} |
{DOMElement} | The created node, either a ‘wpt’ or a ‘trk’. |
buildTrkSegNode: function( geometry )
Builds trkseg node(s) given a geometry
trknode geometry - {OpenLayers.Geometry}
buildTrkPtNode: function( point )
Builds a trkpt node given a point
point | {OpenLayers.Geometry.Point} |
{DOMElement} A trkpt node
buildWptNode: function( geometry )
Builds a wpt node given a point
geometry | {OpenLayers.Geometry.Point} |
{DOMElement} A wpt node
appendAttributesNode: function( node, feature )
Adds some attributes node.
node | {DOMElement} the node to append the attribute nodes to. |
feature | {OpenLayers.Feature.Vector} |
Return a list of features from a GPX doc
read: function( doc )
extractSegment: function( segment, segmentType )
parseAttributes: function( node )
Accepts Feature Collection, and returns a string.
write: function( features, metadata )
Creates a “metadata” node.
buildMetadataNode: function( metadata )
Accepts an OpenLayers.Feature.Vector, and builds a node for it.
buildFeatureNode: function( feature )
Builds trkseg node(s) given a geometry
buildTrkSegNode: function( geometry )
Builds a trkpt node given a point
buildTrkPtNode: function( point )
Builds a wpt node given a point
buildWptNode: function( geometry )
Adds some attributes node.
appendAttributesNode: function( node, feature )