Gadm
A library that provides all countries's national and prefectural boundaries.
Install / Use
/learn @xmba15/GadmREADME
📝 GADM
This library provides all countries's national and prefectural boundaries in the form of geopandas dataframe, by dynamically fetching from GADM dataset.
:gear: Installation
pip install gadm
:running: 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
<p align="center">
<img src="https://raw.githubusercontent.com/xmba15/gadm/master/docs/images/sample_plot_on_folium_map.jpg" alt="folium map sample">
</p>
Download satellite images based on boundaries from gadm
Check the following example
🎛 Development Environment
conda env create --file environment.yml
conda activate gadm
Related Skills
node-connect
341.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
341.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.6kCommit, push, and open a PR
