send_the_raven.geoaddress.Geocoder#

class send_the_raven.geoaddress.Geocoder[source]#

Bases: Addresses

Geocoder for Geoaddresses. When the instance is called, it will start geocoding addresses with geopy_geocoder of your choice.

Example

>>> addresses = [GeoAddress(...), ...]
>>> geocoder = Geocoder(addresses)
>>> geocoder("nominatim", {"user_agent": "my_app"})
>>> for address in geocoder.addresses:
>>>     print(address.latitude, address.longitude)
__init__(addresses, field_mapping={'address_line_2': 'address_line_2', 'city': 'city', 'full_address': 'full_address', 'id': 'id', 'latitude': 'latitude', 'longitude': 'longitude', 'state': 'state', 'street': 'street', 'zip_code': 'zip_code'})[source]#
Parameters:
__call__(geocoder_name, args)[source]#

Start Geocode the addresses. This function will return adter all addresses are geocoded.

Parameters:
  • geocoder_name (str) – Geocoder to use.

  • args (dict[str, Any]) – Arguments to pass to geopy.geocoders.get_geocoder_for_service().

Methods

__eq__(value, /)

Return self==value.

__getitem__(index)

__init__(addresses[, field_mapping])

__iter__()

__len__()

geocode(address, geocoder)

Geocode address with geopy_geocoder.

normalize_parallel([number_of_proccesses])

Normalize all addresses in parallel.

start_geocode(geocoder_name, args)

Start geocoding process asyncronously.

__init__(addresses, field_mapping={'address_line_2': 'address_line_2', 'city': 'city', 'full_address': 'full_address', 'id': 'id', 'latitude': 'latitude', 'longitude': 'longitude', 'state': 'state', 'street': 'street', 'zip_code': 'zip_code'})[source]#
Parameters:
async geocode(address, geocoder)[source]#

Geocode address with geopy_geocoder. If geocoding fails, the address is added to the errors list. When you are bringing your own async runner, limiter, geocoder, feel free to use this function by providing it the geocoder.

Parameters:
normalize_parallel(number_of_proccesses=None)#

Normalize all addresses in parallel. Uses multiprocessing.Pool.map().

Parameters:

number_of_proccesses (int) – number of process

async start_geocode(geocoder_name, args)[source]#

Start geocoding process asyncronously. If you want to use a less stricting AsyncRateLimiter, feel free to use your own. If you have your own async runner, feel free to run this function on your own.

Parameters: