Skip to content

Boundaries

load_boundaries() is the entry point for every map: it returns a GeoDataFrame of administrative polygons for a place and level.

import acadgis as agis

gdf = agis.load_boundaries("Bangladesh", level="district")

Friendly level names

Instead of remembering GADM's numeric levels, use plain names. AcadGIS maps them to the right level for each country:

Name GADM level Example
country 0 Bangladesh
state / division / governorate 1 Dhaka
district 2 Madaripur
upazila / subdistrict 3 (where available)
agis.load_boundaries("Iraq", "country")
agis.load_boundaries("India", "state")
agis.load_boundaries("Bangladesh", "district")

Filter to a parent region with within

Get only the districts inside one division:

dhaka_districts = agis.load_boundaries("Bangladesh", "district", within="Dhaka")

within matches the parent name with the same fuzzy logic used for choropleths, so small spelling differences are tolerated.

Where the data comes from

  1. Bundled samples — Bangladesh, Iraq, India and the USA ship inside the package and load instantly, offline.
  2. Local cache — anything downloaded before is reused.
  3. Live GADM download — for any other country, AcadGIS fetches from GADM and caches it. Requires pip install "acadgis[download]".
# Force or disable the network step explicitly
agis.load_boundaries("Kenya", "county", download=True)

Country-name aliases

Common aliases resolve automatically, e.g. "USA"United States.

It's just a GeoDataFrame

The result is a standard GeoDataFrame, so the whole geopandas/shapely ecosystem is available:

gdf = agis.load_boundaries("Bangladesh", "district")
gdf = gdf.to_crs(3857)            # reproject
big = gdf[gdf.area > gdf.area.median()]

Next: turn boundaries into a styled map.