Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/ gadm Public

A library that provides all countries's national and prefectural boundaries.

License

Notifications You must be signed in to change notification settings

xmba15/gadm

Repository files navigation

PyPi PyPi Build Status

πŸ“ 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

folium map sample

Download satellite images based on boundaries from gadm


Check the following example

πŸŽ› Development Environment


conda env create --file environment.yml
conda activate gadm

About

A library that provides all countries's national and prefectural boundaries.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /