Python bindings for liblocation

Module constants

Interval between fixes:

location.INTERVAL_DEFAULT

Default value for the system.

location.INTERVAL_1S

1 second between subsequent fixes.

location.INTERVAL_2S

2 seconds between subsequent fixes.

location.INTERVAL_5S

5 seconds between subsequent fixes

location.INTERVAL_10S

10 seconds between subsequent fixes.

location.INTERVAL_20S

20 seconds between subsequent fixes.

location.INTERVAL_30S

30 seconds between subsequent fixes.

location.INTERVAL_60S

60 seconds between subsequent fixes.

location.INTERVAL_120S

120 seconds between subsequent fixes.

Location methods

location.LOCATION_METHOD_USER_SELECTED

The method is based on the current device settings. This is the default.

location.LOCATION_METHOD_CWP

Use the Complimentary Wireless Position method.

location.LOCATION_METHOD_ACWP

Use the Assisted Complimentary Wireless Position method.

location.LOCATION_METHOD_GNSS

Use the Global Navigation Satellite System method.

location.LOCATION_METHOD_AGNSS

Use the Assisted Global Navigation Satellite System method.

Location errors

location.ERROR_USER_REJECTED_DIALOG

User rejected location enabling dialog.

location.ERROR_USER_REJECTED_SETTINGS

User changed settings which disabled locationing.

location.ERROR_BT_GPS_NOT_AVAILABLE

Problems using BT GPS.

location.ERROR_METHOD_NOT_ALLOWED_IN_OFFLINE_MODE

Method unavailable in offline mode.

location.ERROR_SYSTEM

System error, dbus, hildon, etc.

Fix statuses

location.GPS_DEVICE_STATUS_NO_FIX

The device does not have a fix.

location.GPS_DEVICE_STATUS_FIX

The device has a fix.

location.GPS_DEVICE_STATUS_DGPS_FIX

The device has a DGPS fix. (Deprecated: this constant is not used anymore.)

Device modes

location.GPS_DEVICE_MODE_NOT_SEEN

The device has not seen a satellite yet.

location.GPS_DEVICE_MODE_NO_FIX

The device has no fix.

location.GPS_DEVICE_MODE_2D

The device has latitude and longitude fix.

location.GPS_DEVICE_MODE_3D

The device has latitude, longitude, and altitude.

Miscellaneous functions

location.distance_between(latitude_s, longitude_s, latitude_f, longitude_f)

Calculates the circle distance between two points, the origin (described by latitude_s, longitude_s) and the destination (described by latitude_f, longitude_f).

Parameters:
  • latitude_s – Origin latitude
  • longitute_s – Origin longitude
  • latitude_f – Destination latitude
  • longitude_f – Destination longitude
Returns:

Distance in km between the two points

location.make_resident()

Loads the location library into memory and makes it resident so that it cannot be unloaded.

Warning

make_resident is deprecated and should not be used in newly-written code.