implementations of geocoder_reverse using natural_earth shape-files
Project description
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'
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"])
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file geocoder_reverse_natural_earth-0.0.2.tar.gz
.
File metadata
- Download URL: geocoder_reverse_natural_earth-0.0.2.tar.gz
- Upload date:
- Size: 4.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 894a997660ec1ab149bb9527dfe5a383e5e2a965d3976e489de3ee65037435b6 |
|
MD5 | 438945b041f80d0fe5dcbacd318a0dee |
|
BLAKE2b-256 | f12c2c4be70278b97a76a98f882fae7e73d758d7e83895b5e5cbddf6b8b91835 |
Provenance
File details
Details for the file geocoder_reverse_natural_earth-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: geocoder_reverse_natural_earth-0.0.2-py3-none-any.whl
- Upload date:
- Size: 4.9 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e43f4889a0149dc887d7359eeea0e8f302fcf0650de0a82cf01bfd66c06c783 |
|
MD5 | 2e4fd668ee3a582eb2b3f4980d938cb4 |
|
BLAKE2b-256 | a32db0e50516423374bc0c8ed7e4b4bd5b102bce259f55976442705753cadc2f |