Skip to content

laser.measles.demographics.gadm

laser.measles.demographics.gadm

GADM shapefiles

laser.measles.demographics.gadm.GADMShapefile

Bases: AdminShapefile

Shapefile reader for GADM (Global Administrative Areas) boundary data.

Automatically determines the admin level from the GADM filename and downloads shapefiles from the GADM servers when needed. Use download to fetch a country's boundaries, or construct directly from a local file.

Example:

1
2
3
4
```python
gadm = GADMShapefile.download("NGA", admin_level=2, directory="./data")
df = gadm.get_dataframe()
```

laser.measles.demographics.gadm.GADMShapefile.check_dotname_fields()

Check dotname_fields from shapefile name if not explicitly provided.

laser.measles.demographics.gadm.GADMShapefile.download(country_code, admin_level, directory=None, timeout=60) classmethod

Download the GADM shapefile for a given country code and return a GADMShapefile instance.

Parameters:

Name Type Description Default
country_code str

The country code to download the shapefile for.

required
admin_level int

The admin level to download the shapefile for.

required
directory str | Path | None

The directory to download the shapefile to. If None, uses current directory.

None
timeout int

The timeout for the request.

60

Returns:

Type Description
GADMShapefile

A GADMShapefile instance for the downloaded shapefile.