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 separate node.
shareNode{Boolean} Should nodes be shared between geometries.
interestingTagsExclude{Array} List of tags to exclude from ‘interesting’ checks on nodes.
areaTags{Array} List of tags indicating that something is an area.
relationsParsers{Map({String, Function})} Map relation type to a functions that parce the relation.
Constructor
OpenLayers.Format.OSMCreate a new parser for OSM.
Functions
getPointListReturn a list of points corresponds with with the way.
concatPathsIfLinearReturn result.succed if pass are linear, result.lastPointList with the new way.
getsReturn the node items from a doc.
getRelationsReturn the relation 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 separate node.  Will slow down parsing.  Default is false.

shareNode

{Boolean} Should nodes be shared between geometries.

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.

relationsParsers

{Map({String, Function})} Map relation type to a functions that parce the relation.  This can be set for example to: { multipolygon: OpenLayers.Format.OSM.multipolygonParser, boundary: OpenLayers.Format.OSM.multipolygonParser, route: OpenLayers.Format.OSM.routeParser }

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

getPointList

getPointList: function(way,
nodes)

Return a list of points corresponds with with the way.

Parameters

wayway where we can find the nodes id.
nodesnodes the nodes map where we can find the nodes by id.

concatPathsIfLinear

concatPathsIfLinear: function(lastPointList,
pointList)

Return result.succed if pass are linear, result.lastPointList with the new way.

Parameters

lastPointListarray of <OpenLayer.Geometry.Points>, the old concanated path
pointListarray of <OpenLayer.Geometry.Points>, the new path

gets

Return the node items from a doc.

Parameters

doc{DOMElement} node to parse tags from

getRelations

getRelations: function(doc)

Return the relation items from a doc.

Parameters

node{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}
getPointList: function(way,
nodes)
Return a list of points corresponds with with the way.
concatPathsIfLinear: function(lastPointList,
pointList)
Return result.succed if pass are linear, result.lastPointList with the new way.
getRelations: function(doc)
Return the relation 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