Package mosp :: Package geo :: Module osm
[hide private]
[frames] | no frames]

Module osm

source code

Loading OSM XML data and storing it into an OSMModel.

OSM XML data is loaded and manipulated via OSMXMLFileParser within OSMModel. An OSMModel stores the OSM data for simulation. These and subordinated classes are originally built upon code from https://github.com/rory/python-osm


Author: B. Henne, F. Ludwig, P. Tute, R. McCann

Contact: henne@dcsec.uni-hannover.de

Copyright: (c) 2008-2011 Rory McCann, 2010-2012, DCSec, Leibniz Universitaet Hannover, Germany

License: GPLv3

Classes [hide private]
  Node
A geo-model node.
  Way
A geo-model way.
  WaySegment
A geo-model way segment, the line between two nodes
  NodePlaceHolder
Placeholder for OSM nodes while parsing the OSM data.
  OSMModel
A OSM-based geo-model.
  OSMXMLFileParser
The OSM XML parser.
Functions [hide private]
 
round_utm_coord(x)
Rounds UTM coordinate to demanded precision.
source code
 
wayangle(src_node, dest_node)
Calculates the angle between the way from src_node to dest_node and positive x-axis of a plane.
source code
 
calc_width(way)
Calculates the width of a way based on osm tags and width defaults.
source code
 
distance(node1, node2)
Calculates the euclidean distance of two nodes in the plane.
source code
Variables [hide private]
  GLOBAL_SIM = None
hash(x)
  ROADTYPE_NODIMENSION = 0
constant/no road dimension - road width = 0
  ROADTYPE_ONEWAY_NOSIDEWALK = 1
constant/road width = width from the middle of road to the right in walking direction (as int)
  ROADTYPE_TWOWAY_NOSIDEWALK = 2
constant/road width = 2xwidth from the left of the road to the right both directions lanes (as int)
  ROADTYPE_ONEWAY_ONSIDEWALK = 3
constant/no movement on street, but only on sidewalk (as list [road width per direction, sidewalk width+road width per direction]
  ROADTYPE = 0
used ROADTYPE model
  ROADWIDTH_DEFAULTS = {'else': 2, 'footway': 2, 'primary': 4, '...
defaults for roads without any width tags
  __package__ = 'mosp.geo'
Function Details [hide private]

round_utm_coord(x)

source code 

Rounds UTM coordinate to demanded precision.

Rounds value x up to 3 decimal places. UTM value precision down to millimeter.

Author: B. Henne

wayangle(src_node, dest_node)

source code 

Calculates the angle between the way from src_node to dest_node and positive x-axis of a plane.

Author: B. Henne

calc_width(way)

source code 

Calculates the width of a way based on osm tags and width defaults.

Author: B. Henne

To Do: add more road width calculation magic

distance(node1, node2)

source code 

Calculates the euclidean distance of two nodes in the plane.

Calculates the distance of two nodes described by UTM coordinates x,y in the area by the euclidean distance using the Pythagorean theorem.

Author: B. Henne


Variables Details [hide private]

ROADWIDTH_DEFAULTS

defaults for roads without any width tags

Value:
{'else': 2,
 'footway': 2,
 'primary': 4,
 'secondary': 4,
 'service': 2,
 'tertiary': 3}