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 Provenance Actions
geonames_postcode-0.3.tar.gz 17.9 kB Without provenance Details for geonames_postcode-0.3.tar.gz

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

Security for geonames-postcode 0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3 This release

1 release file No provenance

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