Skip to main content

geonames_postcode

geonames_postcode is a Python package to make geonames.org postcode databases accessible in Python. It provides a command line tool to fetch, preprocess, and store the data in a Python file per country. In the result very fast (in-memory) queries by postcodes and names are available using just a few MB per country. Some helper functions are part of the package to solve common tasks like getting distances and finding postcodes nearby.

Quickstart

Please respect the license of the geonames.org data (Creative Commons Attribution 4.0 License), see geonames.org for details.

On the console:

pip install geonames_postcode
geonames_postcode_fetch DE

In Python:

>>> import geonames_postcode
>>> latlong1 = geonames_postcode.coordinates('DE', 'Unterschleißheim')
>>> latlong1
(48.2804, 11.5768)
>>> latlong2 = geonames_postcode.coordinates('DE', 'München')
>>> geonames_postcode.distance(*latlong1, *latlong2)
15.289746063637923
>>> geonames_postcode.nearby_postcodes('DE', *latlong1, 5)
['85386', '85716', '85764', '85778']
>>> geonames_postcode.postcode_names('DE', '85764')
['Oberschleißheim']
>>> geonames_postcode.name_autocomplete('DE', 'Münche')
['München', 'Müncheberg', 'Münchehofe', 'Münchenbernsdorf']

Usage

see https://geonames-postcode.readthedocs.io/

License

The project is licensed under the GPLv2+.

Metadata

Release files for geonames-postcode 0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for geonames-postcode 0.3
File Size Uploaded
geonames_postcode-0.3.tar.gz 17.9 kB Details

Release files / geonames_postcode-0.3.tar.gz

Download URL geonames_postcode-0.3.tar.gz
Size 17.9 kB
Tags Source
SHA-256 checksum
How to use checksums
144e7aa025aed012f212919ffc227d18073afdd7261e159caa7df660e4795c25
BLAKE2b-256 checksum
How to use checksums
846ad2f2d4c1d21d5dc784bc094406622b0c724bbdfbd621a86decf1fa2a2251
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.3 This release

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page