# OpenLayers.Format.OSM

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

#### Inherits from

- OpenLayers.Format.XML

Summary

OpenLayers.Format.OSM | OSM 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.OSM | Create a new parser for OSM.
Functions |
getNodes | Return the node items from a doc.
getWays | Return the way items from a doc.
getTags | Return the tags list attached to a specific DOM element.
isWayArea | Given a way object from getWays, check whether the tags and geometry indicate something is an area.
write | Takes a list of features, returns a serialized OSM format file for use in tools like JOSM.
createFeatureNodes | 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 | Given a feature, serialize the attributes onto the given node.
setState | OpenStreetMap 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

doc | {DOMElement} node to parse tags from

### getWays

> getWays: function( | doc | )

Return the way items from a doc.

#### Parameters

doc | {DOMElement} node to parse tags from

### getTags

> getTags: function( | dom_node,
> | interesting_tags | )

Return the tags list attached to a specific DOM element.

#### Parameters

dom_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.
Vector features use the OpenLayers.Geometry classes as geometry description.
Close