python-geoclue

python-geoclue is a Geoclue python module. This module does not implement python bindings in Geoclue. Maybe it will sometime in the future.
This module uses the Geoclue D-Bus API to implement a nice API for python developers and facilitate their life.

Where to get it

  • Code - You can get the code by cloning the Git repository with the command below. Alternatively, you can browse the code

    • git clone git://anongit.freedesktop.org/git/python-geoclue
      mirror: git@github.com:pcabido/python-geoclue.git

  • Source releases - You can get the latest tarball here:

How to install it

Python-geoclue is available in all major distributions. Use the application installer software for your distro to install the python-geoclue package.

From the source it can be installed by running (this example is valid in Ubuntu, in other distros the root access method might be different):

  • sudo ./setup.py install (you have to install it as root)

How to use it

There is a test file (test.py) in a folder named tests/ that is available with the source. This file provides examples of how you can use all or almost all the methods available.

The API for the existing methods is available here.

Example

   1 import Geoclue
   2 
   3 # Note: this program will work in Ubuntu without
   4 # the need to install any additional packages, but for 
   5 # other distributions you'll need to install a suitable
   6 # position provider. In Debian and Ubuntu you can
   7 # add additional providers by installing the geoip-*
   8 # packages
   9 POS_PROVIDER = 'Ubuntu GeoIP'
  10 
  11 location = Geoclue.DiscoverLocation()
  12 location.init()
  13 location.set_position_provider(POS_PROVIDER)
  14 position = location.get_location_info()
  15 
  16 print position['latitude']
  17 print position['longitude']

Apps/GTG/soc/python_geoclue (last edited 2015-01-06 10:33:40 by OliverPropst)