upoints.nmea.Position

Package upoints :: Module nmea :: Class Position |
[hide private]
[frames] | no frames]

# Class Position

     object --+
              |
    point.Point --+
                  |
                 Position

Class for representing a GPS NMEA-formatted position

Since: 0.8.0

Instance Methods | [hide private]
__init__(self, time, status, latitude, longitude, speed, track, date, variation, mode=None) Initialise a new Position object |
`str` |
__str__(self) Pretty printed position string |
`str` |
mode_string(self) Return a string version of the reading mode information |
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__`

Static Methods | [hide private]
Fix |
parse_elements(elements) Parse position data elements |

Instance Variables | [hide private]
| date Date when position was taken
| latitude Location's latitude
| longitude Locations's longitude
| mode Type of reading
| speed Unit's speed in knots
| status GPS status
| time Time the position was taken
| track Track angle
| variation Magnetic variation
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, time, status, latitude, longitude, speed, track, date, variation, mode=None) (Constructor) |
Initialise a new Position object
    >>> Position(datetime.time(14, 20, 58), True, 53.1440233333, -3.01542833333,
    ...          109394.7, 202.9, datetime.date(2007, 11, 19), 5.0)
    Position(datetime.time(14, 20, 58), True, 53.1440233333, -3.01542833333,
             109394.7, 202.9, datetime.date(2007, 11, 19), 5.0, None)
Parameters: `time` (`datetime.time`) - Time the fix was taken `status` (`bool`) - Whether the data is active `latitude` (`float` or coercible to `float`) - Fix's latitude `longitude` (`float` or coercible to `float`) - Fix's longitude `speed` (`float` or coercible to `float`) - Ground speed `track` (`float` or coercible to `float`) - Track angle `date` (`datetime.date`) - Date when position was taken `variation` (`float` or coercible to `float`) - Magnetic variation `mode` (`str`) - Type of reading Raises: `ValueError` - Unknown value for `angle` `ValueError` - Unknown value for units `ValueError` - Invalid value for latitude or longitude Overrides: object.__init__

### __str__(self) (Informal representation operator) |
Pretty printed position string
    >>> print(Position(datetime.time(14, 20, 58), True, 53.1440233333,
    ...                -3.01542833333, 109394.7, 202.9,
    ...                datetime.date(2007, 11, 19), 5.0))
    $GPRMC,142058,A,5308.6414,N,00300.9257,W,109394.7,202.9,191107,5,E*41
Parameters: `mode` - Coordinate formatting system to use Returns: `str` Human readable string representation of Position object Raises: `ValueError` - Unknown value for mode Overrides: object.__str__

### mode_string(self) |
Return a string version of the reading mode information
    >>> position = Position(datetime.time(14, 20, 58), True, 53.1440233333,
    ...                     -3.01542833333, 109394.7, 202.9,
    ...                     datetime.date(2007, 11, 19), 5.0)
    >>> print(position.mode_string())
    Unknown
    >>> position.mode = "A"
    >>> print(position.mode_string())
    Autonomous
Returns: `str` Quality information as string

### parse_elements(elements) Static Method |
Parse position data elements
    >>> Position.parse_elements(["142058", "A", "5308.6414", "N",
    ...                          "00300.9257", "W", "109394.7", "202.9",
    ...                          "191107", "5", "E", "A"])
    Position(datetime.time(14, 20, 58), True, 53.1440233333, -3.01542833333,
             109394.7, 202.9, datetime.date(2007, 11, 19), 5.0, 'A')
    >>> Position.parse_elements(["142100", "A", "5200.9000", "N",
    ...                          "00316.6600", "W", "123142.7", "188.1",
    ...                          "191107", "5", "E", "A"])
    Position(datetime.time(14, 21), True, 52.015, -3.27766666667, 123142.7,
             188.1, datetime.date(2007, 11, 19), 5.0, 'A')
Parameters: `elements` (`list`) - Data values for fix Returns: Fix Fix object representing data