Exemplo n.º 1
0
def geopy_get_address_by_coordinates_using_geonames(coordinates):
    from geopy.geocoders import GeoNames
    print 'Search by Geonames coordinates, query: ', coordinates
    geolocator = GeoNames(username=GEONAMES_USER_NAME)
    address = geolocator.reverse(coordinates)
    if address != None:
        print 'Search by Geonames coordinates, address: ', address[0].address
        print 'Search by Geonames coordinates, coordinates:', address[0].latitude, address[0].longitude
        print 'Search by Geonames coordinates, location raw:', address[0].raw
    else:
        print 'Search by Geonames coordinates, address for coordinates:', coordinates, 'could not be found.'
    return address