# -*- coding: utf-8 -*-
#example of how to use the reverse geocoding
import dbus

bus = dbus.SessionBus()

coordinates = []

try:
	geoclue = bus.get_object('org.freedesktop.Geoclue.Providers.Geonames',
						 '/org/freedesktop/Geoclue/Providers/Geonames')
							 
	revgeocoder = dbus.Interface(geoclue, 'org.freedesktop.Geoclue.ReverseGeocode')
							 
except:
	print "D-Bus error."
	
#coordinates for my city, Évora:
# latitude: 38.5833333
# longitude: -7.8333333
#try:
print revgeocoder.PositionToAddress(float(38.5833333), float(-7.8333333), (3,0,0))
	
		
#except Exception, e:
#	print "D-Bus error: %s" % e

