This is a address formatter that can format addresses in multiple formats that are common in different countries.
For formatting the addresses the worldwide.yml
from OpenCageData address-formatting repository is used to format the address according to customs in the country that is been encoded.
See README.md
in the repository for more information.
- Bugfix: Package did not find its data-file because of wrong path calculation
- Initial release, split out of the osmgeocoder project
The complete project contains actually only one class:
Publicly accessible method prototypes are:
def __init__(self, config=None):
pass
def format(self, address, country=None):
pass
def one_line(self, address, country=None):
pass
Initialize the address formatter
config
: (optional) override default config file to use for the address formatter, defaults to config file included in this package
Format an address in the default layout used in the specified country. Return value may contain line breaks.
address
: Dictionary that contains the address parts, see below for recognized keyscountry
: Country code of the formatting template to use
Recognized keys in address
:
attention
house
road
house_number
postcode
city
town
village
county
state
country
suburb
city_district
state_district
state_code
neighbourhood
Works the same as format
but returns a single line of text.