geocoder_reverse_natural_earth
Reverse lookup of locations using Natural-Earths administrative boundary shp-database. This allows a simple lookup from geo-location in latitude/longitude to a countries ISO2 code.
License
The python code in this package is licensed under the LGPL >= 2.1, see LICENSE.
The Natural-Earth database included as zip file is in public domain, see https://www.naturalearthdata.com/about/terms-of-use/ .
Installation
The following will install geocoder_reverse_natural_earth and all dependencies.
python -m pip install geocoder_reverse_natural_earth
or for the latest development version:
python -m pip install 'geocoder_reverse_natural_earth@git+https://github.com/metno/geocoder_reverse_natural_earth.git'
As of version 0.0.3, this package can run with the pure-python pyshp shape-reader and shapely's STRtree, thus removing the dependency on fiona/gdal and rtree. If fiona and gdal is installed anyway, it will continue using the old dependencies.
Testing
Install the package from a local checkout and run the test suite:
python -m pip install .
python -m unittest discover -s tests
Usage
geocoder_reverse_natural_earth is small helper to identify country codes for obs networks that don't mention the countrycode of a station in their location data
from geocoder_reverse_natural_earth import (
Geocoder_Reverse_NE,
Geocoder_Reverse_Exception,
)
geo = Geocoder_Reverse_NE()
print(geo.lookup(60, 10)["ISO_A2_EH"])
lat = 78.2361926
lon = 15.3692614
try:
geo.lookup(lat, lon)
except Geocoder_Reverse_Exception as grex:
dummy = geo.lookup_nearest(lat, lon)
if dummy is None:
print(f"error: {lat},{lon}")
else:
print(dummy["ISO_A2_EH"])
Metadata
Release files for geocoder-reverse-natural-earth 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| geocoder_reverse_natural_earth-0.0.3.tar.gz | 4.9 MB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| geocoder_reverse_natural_earth-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.8 MB
Release files / geocoder_reverse_natural_earth-0.0.3.tar.gz
| Download URL | geocoder_reverse_natural_earth-0.0.3.tar.gz |
|---|---|
| Size | 4.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
732597c0c84a5ef07bae586ee9f2c179be76e7762c80a30347f01bc4f478e7b5
|
|
BLAKE2b-256 checksum How to use checksums |
a5ff36b5db8b943e56cb085cc728dc03f4d3cd3c41e5dd709a6af8eb6ad63917
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logRelease files / geocoder_reverse_natural_earth-0.0.3-py3-none-any.whl
| Download URL | geocoder_reverse_natural_earth-0.0.3-py3-none-any.whl |
|---|---|
| Size | 4.9 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9037d0cf276857d553d31a62f798e41cf8040c07a5b600aedb341cdd1daa5dd7
|
|
BLAKE2b-256 checksum How to use checksums |
be63b9641645a5c571e5fc6975916577c8c906ce21a581c189509254cd165269
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logSecurity for geocoder-reverse-natural-earth 0.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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for geocoder_reverse_natural_earth-0.0.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logA 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.