upoints.osm

Package upoints :: Module osm |
[hide private]
[frames] | no frames]

# Module osm

osm - Imports OpenStreetMap data files

Version: 0.11.0

Classes | [hide private]
| TzOffset Time offset from UTC
| Timestamp Class for representing an OSM timestamp value
| Node Class for representing a node element from OSM data files
| Way Class for representing a way element from OSM data files
| Osm Class for representing an OSM region

Functions | [hide private]
`tuple` |
_parse_flags(element) Parse OSM XML element for generic data |
`list` |
_get_flags(osm_obj) Create element independent flags output |
`str` |
get_area_url(location, distance) Generate URL for downloading OSM data within a region |

Function Details | [hide private]

### _parse_flags(element) |
Parse OSM XML element for generic data Parameters: `element` (ET.Element) - Element to parse Returns: `tuple` Generic OSM data for object instantiation

### _get_flags(osm_obj) |
Create element independent flags output Parameters: `osm_obj` - Object with OSM-style metadata Returns: `list` Human readable flags output

### get_area_url(location, distance) |
Generate URL for downloading OSM data within a region This function defines a boundary box where the edges touch a circle of `distance` kilometres in radius. It is important to note that the box is neither a square, nor bounded within the circle. The bounding box is strictly a trapezoid whose north and south edges are different lengths, which is longer is dependant on whether the box is calculated for a location in the Northern or Southern hemisphere. You will get a shorter north edge in the Northern hemisphere, and vice versa. This is simply because we are applying a flat transformation to a spherical object, however for all general cases the difference will be negligible.
    >>> get_area_url(point.Point(52.015, -0.221), 3)
    'http://api.openstreetmap.org/api/0.5/map?bbox=-0.264864438253,51.9880034021,-0.177135561747,52.0419965979'
    >>> get_area_url(point.Point(52.015, -0.221), 12)
    'http://api.openstreetmap.org/api/0.5/map?bbox=-0.396457433591,51.9070136086,-0.045542566409,52.1229863914'
Parameters: `location` (Point-like object) - Centre of the region `distance` (`int`) - Boundary distance in kilometres Returns: `str` URL that can be used to fetch the OSM data within `distance` of `location`