pgeocode.GeoDistance

class pgeocode.GeoDistance(country: str = 'fr', errors: str = 'ignore')[source]

Distance calculation from a city name or a postal code

Parameters:
  • data_path (str) – path to the dataset
  • error (str, default='ignore') – how to handle not found elements. One of ‘ignore’ (return NaNs), ‘error’ (raise an exception), ‘nearest’ (find from nearest valid points)
__init__(country: str = 'fr', errors: str = 'ignore')[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(country, errors) Initialize self.
query_location(name) Get locations information from a community/minicipality name
query_postal_code(x, y) Get distance (in km) between postal codes
query_location(name)[source]

Get locations information from a community/minicipality name

query_postal_code(x, y)[source]

Get distance (in km) between postal codes

Parameters:
  • x (array, list or int) – a list of postal codes
  • y (array, list or int) – a list of postal codes
Returns:

d – the calculated distances

Return type:

array or int