📝 GADM
This library provides all countries's national and prefectural boundaries in the form of geopandas dataframe, by dynamically fetching from GADM dataset.
⚙️ Installation
pip install gadm
🏃 How to Run
Basic usage
import geopandas as gpd
from gadm import GADMDownloader
downloader = GADMDownloader(version="4.0")
country_name = "Vietnam"
ad_level = 0
gdf = downloader.get_shape_data_by_country_name(country_name=country_name, ad_level=ad_level)
assert isinstance(gdf, gpd.GeoDataFrame)
gdf.plot()
Use with visualization library
GADM's data frame can be interactively visualized on a jupyter notebook with folium
import folium as fl
import geopandas as gpd
from gadm import GADMDownloader
downloader = GADMDownloader(version="4.0")
country_name = "Vietnam"
ad_level = 1
gdf = downloader.get_shape_data_by_country_name(country_name=country_name, ad_level=ad_level)
m = fl.Map(zoom_start=10, tiles="OpenStreetMap")
for _, r in gdf.iterrows():
sim_geo = gpd.GeoSeries(r["geometry"]).simplify(tolerance=0.001)
geo_j = sim_geo.to_json()
geo_j = fl.GeoJson(data=geo_j, style_function=lambda x: {"fillColor": "orange"})
fl.Popup(r["VARNAME_1"]).add_to(geo_j)
geo_j.add_to(m)
m
Download satellite images based on boundaries from gadm
Check the following example
🎛 Development Environment
conda env create --file environment.yml
conda activate gadm
Metadata
Release files for gadm 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gadm-0.0.5.tar.gz | 5.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gadm-0.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.2 kB
Release files / gadm-0.0.5.tar.gz
| Download URL | gadm-0.0.5.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d1679687f5bd9d22607534f32ce1481057f21d7217c0749efc2a48e4dcdf991c
|
|
BLAKE2b-256 checksum How to use checksums |
c15a36aae4867be617c50492a950e207d8aa410f65b4b791eee82c0231644a8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.18
|
Release files / gadm-0.0.5-py3-none-any.whl
| Download URL | gadm-0.0.5-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
49dabda07eb61c77d2870333abad78544d91bec312ce2101d52b3d6a1cc5475b
|
|
BLAKE2b-256 checksum How to use checksums |
7c82230755217bdd849196c017c18cd1f4549ac81f3e89625ebab4403d5038cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.18
|