upoints.gpx._GpxElem

Package upoints :: Module gpx :: Class _GpxElem |
[hide private]
[frames] | no frames]

# Class _GpxElem

     object --+
              |
    point.Point --+
                  |
                 _GpxElem

Known Subclasses:
  - Trackpoint
  - , Waypoint

Abstract class for representing an element from GPX data files

Since: 0.11.0

Instance Methods | [hide private]
__init__(self, latitude, longitude, name=None, description=None) Initialise a new Waypoint object |
`str` |
__str__(self, mode=`'``dms``'`) Pretty printed location string |
`ET.Element` |
togpx(self, gpx_version=`'``1.1``'`, human_namespace=False) Generate a GPX waypoint element subtree |
Inherited from `point.Point`: `__dict__`, `__eq__`, `__hash__`, `__ne__`, `__repr__`, `__unicode__`, `bearing`, `destination`, `distance`, `final_bearing`, `forward`, `inverse`, `midpoint`, `sun_events`, `sunrise`, `sunset`, `to_grid_locator` Inherited from `point.Point` (private): `_set_location` Inherited from `object`: `__delattr__`, `__getattribute__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`

Class Variables | [hide private]
| _elem_name = `None`

Instance Variables | [hide private]
| description Waypoint's description
| latitude Location's latitude
| longitude Locations's longitude
| name Waypoint's name
Inherited from `point.Point`: `rad_latitude`, `rad_longitude`, `timezone`, `units`

Properties | [hide private]
Inherited from `point.Point` (private): `_angle`, `_latitude`, `_longitude`, `_rad_latitude`, `_rad_longitude` Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, latitude, longitude, name=None, description=None) (Constructor) |
Initialise a new Waypoint object
    >>> _GpxElem(52, 0)
    _GpxElem(52.0, 0.0, None, None)
    >>> _GpxElem(52, 0, None)
    _GpxElem(52.0, 0.0, None, None)
    >>> _GpxElem(52, 0, "name", "desc")
    _GpxElem(52.0, 0.0, 'name', 'desc')
Parameters: `latitude` (`float` or coercible to `float`) - Element's latitude `longitude` (`float` or coercible to `float`) - Element's longitude `name` (`str`) - Name for Element `description` (`str`) - Element's description Raises: `ValueError` - Unknown value for `angle` `ValueError` - Unknown value for units `ValueError` - Invalid value for latitude or longitude Overrides: object.__init__

### __str__(self, mode=`'``dms``'`) (Informal representation operator) |
Pretty printed location string
    >>> print(_GpxElem(52, 0))
    52°00'00"N, 000°00'00"E
    >>> print(_GpxElem(52, 0, "name", "desc"))
    name (52°00'00"N, 000°00'00"E) [desc]
Parameters: `mode` (`str`) - Coordinate formatting system to use Returns: `str` Human readable string representation of _GpxElem object Raises: `ValueError` - Unknown value for `mode` Overrides: object.__str__

### togpx(self, gpx_version=`'``1.1``'`, human_namespace=False) |
Generate a GPX waypoint element subtree
    >>> ET.tostring(_GpxElem(52, 0).togpx())
    '<ns0:None lat="52.0" lon="0.0" xmlns:ns0="http://www.topografix.com/GPX/1/1" />'
    >>> ET.tostring(_GpxElem(52, 0, "Cambridge").togpx())
    '<ns0:None lat="52.0" lon="0.0" xmlns:ns0="http://www.topografix.com/GPX/1/1"><ns0:name>Cambridge</ns0:name></ns0:None>'
    >>> ET.tostring(_GpxElem(52, 0, "Cambridge", "in the UK").togpx())
    '<ns0:None lat="52.0" lon="0.0" xmlns:ns0="http://www.topografix.com/GPX/1/1"><ns0:name>Cambridge</ns0:name><ns0:desc>in the UK</ns0:desc></ns0:None>'
Parameters: `gpx_version` (`str`) - GPX version to generate `human_namespace` (`bool`) - Whether to generate output using human readable namespace prefixes Returns: `ET.Element` GPX waypoint element