OpenLayers.Format.OSM

OSM parser.  Create a new instance with the OpenLayers.Format.OSM constructor.

Inherits from

Summary
OpenLayers.Format.OSMOSM parser.
Properties
checkTags{Boolean} Should tags be checked to determine whether something should be treated as a seperate node.
interestingTagsExclude{Array} List of tags to exclude from ‘interesting’ checks on nodes.
areaTags{Array} List of tags indicating that something is an area.
Constructor
OpenLayers.Format.OSMCreate a new parser for OSM.
Functions
getNodesReturn the node items from a doc.
getWaysReturn the way items from a doc.
getTagsReturn the tags list attached to a specific DOM element.
isWayAreaGiven a way object from getWays, check whether the tags and geometry indicate something is an area.
writeTakes a list of features, returns a serialized OSM format file for use in tools like JOSM.
createFeatureNodesTakes a feature, returns a list of nodes from size 0->n.
createXMLTakes a feature, returns a list of nodes from size 0->n.
serializeTagsGiven a feature, serialize the attributes onto the given node.
setStateOpenStreetMap has a convention that ‘state’ is stored for modification or deletion.

Properties

checkTags

{Boolean} Should tags be checked to determine whether something should be treated as a seperate node.  Will slow down parsing.  Default is false.

interestingTagsExclude

{Array} List of tags to exclude from ‘interesting’ checks on nodes.  Must be set when creating the format.  Will only be used if checkTags is set.

areaTags

{Array} List of tags indicating that something is an area.  Must be set when creating the format.  Will only be used if checkTags is true.

Constructor

OpenLayers.Format.OSM

Create a new parser for OSM.

Parameters

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

Functions

getNodes

getNodes: function(doc)

Return the node items from a doc.

Parameters

node{DOMElement} node to parse tags from

getWays

getWays: function(doc)

Return the way items from a doc.

Parameters

node{DOMElement} node to parse tags from

getTags

getTags: function(dom_node,
interesting_tags)

Return the tags list attached to a specific DOM element.

Parameters

node{DOMElement} node to parse tags from
interesting_tags{Boolean} whether the return from this function should return a boolean indicating that it has ‘interesting tags’ -- tags like attribution and source are ignored.  (To change the list of tags, see interestingTagsExclude)

Returns

tags{Object} hash of tags
interesting{Boolean} if interesting_tags is passed, returns whether there are any interesting tags on this element.

isWayArea

isWayArea: function(way)

Given a way object from getWays, check whether the tags and geometry indicate something is an area.

Returns

{Boolean}

write

write: function(features)

Takes a list of features, returns a serialized OSM format file for use in tools like JOSM.

Parameters

features{Array(OpenLayers.Feature.Vector)}

createFeatureNodes

createFeatureNodes: function(feature)

Takes a feature, returns a list of nodes from size 0->n.  Will include all pieces of the serialization that are required which have not already been created.  Calls out to createXML based on geometry type.

Parameters

feature{OpenLayers.Feature.Vector}

createXML

createXML:

Takes a feature, returns a list of nodes from size 0->n.  Will include all pieces of the serialization that are required which have not already been created.

Parameters

feature{OpenLayers.Feature.Vector}

serializeTags

serializeTags: function(feature,
node)

Given a feature, serialize the attributes onto the given node.

Parameters

feature{OpenLayers.Feature.Vector}
node{DOMNode}

setState

setState: function(feature,
node)

OpenStreetMap has a convention that ‘state’ is stored for modification or deletion.  This allows the file to be uploaded via JOSM or the bulk uploader tool.

Parameters

feature{OpenLayers.Feature.Vector}
node{DOMNode}
getNodes: function(doc)
Return the node items from a doc.
getWays: function(doc)
Return the way items from a doc.
getTags: function(dom_node,
interesting_tags)
Return the tags list attached to a specific DOM element.
isWayArea: function(way)
Given a way object from getWays, check whether the tags and geometry indicate something is an area.
write: function(features)
Takes a list of features, returns a serialized OSM format file for use in tools like JOSM.
createFeatureNodes: function(feature)
Takes a feature, returns a list of nodes from size 0->n.
createXML:
Takes a feature, returns a list of nodes from size 0->n.
serializeTags: function(feature,
node)
Given a feature, serialize the attributes onto the given node.
setState: function(feature,
node)
OpenStreetMap has a convention that ‘state’ is stored for modification or deletion.
Create a new parser for OSM.
Read and write XML.
Vector features use the OpenLayers.Geometry classes as geometry description.
Close