ll2location
Installation
pip install ll2location
Usage example: Find from all country
from latlong.gadm import Gadm
from latlong.latlong import LatLong
#init all gadm package in all country, it may take a long time, maybe a few hours
gadm = Gadm()
gadm.get_shp_fully()
#init lat long
lat = 10.773213
long = 106.671818
#from lat long to location
latlng = LatLong()
code, country_info, detail_info = latlng.to_location(10.773213, 106.671818)
print(detail_info)
The output could be:
{'GID_3': 'VNM.25.10.4_1',
'GID_0': 'VNM',
'COUNTRY': 'Vietnam',
'GID_1': 'VNM.25_1',
'NAME_1': 'Hồ Chí Minh',
'NL_NAME_1': 'NA',
'GID_2': 'VNM.25.10_1',
'NAME_2': 'Quận 10',
'NL_NAME_2': 'NA',
'NAME_3': 'Phường 12',
'VARNAME_3': 'Ward 12',
'NL_NAME_3': 'NA',
'TYPE_3': 'Phường',
'ENGTYPE_3': 'Ward',
'CC_3': 'NA',
'HASC_3': 'NA'}
Usage example: Find from specific country code
from latlong.latlong import LatLong
from latlong.gadm import Gadm, GetGadm
#show country code infomation
get_gadm = GetGadm()
codes_detail = get_gadm.get_codes_detail()
print(codes_detail)
#init gadm package in specific country
code = "VNM"
gadm = Gadm()
gadm.get_shp_by_code(code)
#init lat long
lat = 10.773213
long = 106.671818
#from lat long to location in specific country
latlng = LatLong()
detail_info = latlng.to_location_by_country_code(code, lat, long)
print(detail_info)
The output could be:
{'GID_3': 'VNM.25.10.4_1',
'GID_0': 'VNM',
'COUNTRY': 'Vietnam',
'GID_1': 'VNM.25_1',
'NAME_1': 'Hồ Chí Minh',
'NL_NAME_1': 'NA',
'GID_2': 'VNM.25.10_1',
'NAME_2': 'Quận 10',
'NL_NAME_2': 'NA',
'NAME_3': 'Phường 12',
'VARNAME_3': 'Ward 12',
'NL_NAME_3': 'NA',
'TYPE_3': 'Phường',
'ENGTYPE_3': 'Ward',
'CC_3': 'NA',
'HASC_3': 'NA'}
LICENSE
From https://gadm.org/license.html.
GADM license The data are freely available for academic use and other non-commercial use. Redistribution or commercial use is not allowed without prior permission.
Using the data to create maps for publishing of academic research articles is allowed. Thus you can use the maps you made with GADM data for figures in articles published by PLoS, Springer Nature, Elsevier, MDPI, etc. You are allowed (but not required) to publish these articles (and the maps they contain) under an open license such as CC-BY as is the case with PLoS journals and may be the case with other open access articles. Data for the following countries is covered by a a different license Austria: Creative Commons Attribution-ShareAlike 2.0 (source: Government of Ausria)
Metadata
Release files for ll2location 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 | Actions |
|---|---|---|---|---|
| ll2location-0.0.3.tar.gz | 4.6 kB | Without provenance | Details for ll2location-0.0.3.tar.gz |
Release files / ll2location-0.0.3.tar.gz
| Download URL | ll2location-0.0.3.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4c7c402b3ad3f12523ff63f318a78001dc0d967a4e175d1018c09de9b8378bf0
|
|
BLAKE2b-256 checksum How to use checksums |
cca86ed7807a1bc6d307437679b96b690c331a3627a4751e7bd8e3308984b4d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Security for ll2location 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.
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.