GPS API Package

Submodules

gps_api.cli module

Console script for gps_api.

gps_api.gps_api module

GPS API instatiates an object of GPS class with a port name on the device to which the GPS module is attached. GPS object provides functions to easily extract data from the NMEA messages received by the GPS module.

class gps_api.gps_api.GPS(port)[source]

Bases: object

clean_string()[source]

clear data held in nmea_msg

get_UTC_time()[source]

get UTC time data from latest nmea message

Returns

UTC time at current position

get_altitude()[source]

get altitude data from latest nmea message

Returns

altitude data at current position

get_current_location()[source]

get current location data from

Returns

current location data in the form (latitude, longitude)

get_date()[source]

get UTC date data from latest nmea message

Returns

UTC date at current position

get_distance(latitude, longitude)[source]

get the distance to another location

Parameters
  • latitude – another location’s latitude

  • longitude – another location’s longitude

Returns

distance to the other position at (latitude, longitude)

get_latitude()[source]

get latitude data from latest nmea message

Returns

latitude data at current position

get_longitude()[source]

get lonitude data from latest nmea message

Returns

longitude data at current position

get_speed()[source]

get speed data from latest nmea message

Returns

current speed in km/h

get_time_of_arrival(latitude, longitude)[source]

get time of arrival to destination (latitude, longitude)

Parameters
  • latitude – destination’s latitude

  • longitude – destination’s longitude

Returns

estimated time of arrival to the destination

reboot()[source]
reboot involves a full cold start

FULL COLD START: time, position, almanacs and ephemeris data will be redownloaded system/user configurations will be cleared process will take approximately 8 minutes, use with patience

instantiate GPS class after reboot to apply the configuration of NMEA message type and frequency

set_another_location(latitude, longitude)[source]

set a location

Parameters
  • latitude – another location’s latitude

  • longitude – another location’s longitude

gps_api.position module

class gps_api.position.Position[source]

Bases: object

position class, used to store latitude, longitude and altitude. get_latitude, get_longitude and get_current_location methods

get_UTC_time()[source]

get UTC time at current position

Returns

current UTC time value

get_altitude()[source]

get altitude at current position

Returns

current altitude value

get_current_location()[source]

get location of current position

Returns

current location in the form of (latitude, longitude)

get_date()[source]

get UTC date at current position

Returns

current UTC date value

get_latitude()[source]

get latitude at current position

Returns

current latitude value

get_longitude()[source]

get longitude at current position

Returns

current longitude value

get_speed()[source]

get current speed over ground

Returns

current speed in km/h

update(nmea_msg)[source]

update the position’s attributes with the NMEA message

Parameters

nmea_msg – The raw NMEA message to be parsed

Module contents

Top-level package for GPS API.