OpenLayers.Format.GPX

Read/write GPX parser.  Create a new instance with the OpenLayers.Format.GPX constructor.

Inherits from

Summary
OpenLayers.Format.GPXRead/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.
creator{String} The creator attribute to be added to the written GPX files.
Constructor
OpenLayers.Format.GPXCreate a new parser for GPX.
Functions
readReturn a list of features from a GPX doc
writeAccepts Feature Collection, and returns a string.

Properties

defaultDesc

{String} Default description for the waypoints/tracks in the case where the feature has no “description” attribute.  Default is “No description available”.

extractWaypoints

{Boolean} Extract waypoints from GPX.  (default: true)

extractTracks

{Boolean} Extract tracks from GPX.  (default: true)

extractRoutes

{Boolean} Extract routes from GPX.  (default: true)

extractAttributes

{Boolean} Extract feature attributes from GPX.  (default: true) NOTE: Attributes as part of extensions to the GPX standard may not be extracted.

creator

{String} The creator attribute to be added to the written GPX files.  Defaults to “OpenLayers”

Constructor

OpenLayers.Format.GPX

Create a new parser for GPX.

Parameters

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

Functions

read

read: function(doc)

Return a list of features from a GPX doc

Parameters

doc{Element}

Returns

Array({OpenLayers.Feature.Vector})

write

write: function(features,
metadata)

Accepts Feature Collection, and returns a string.

Parameters

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’.
read: function(doc)
Return a list of features from a GPX doc
write: function(features,
metadata)
Accepts Feature Collection, and returns a string.
Create a new parser for GPX.
Read and write XML.
Vector features use the OpenLayers.Geometry classes as geometry description.
Close