GADMShapefile#

class GADMShapefile(**data)[source]#

Bases: AdminShapefile

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

check_dotname_fields()[source]#

Check dotname_fields from shapefile name if not explicitly provided.

Return type:

GADMShapefile

classmethod download(country_code, admin_level, directory=None, timeout=60)[source]#

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

Parameters:
  • country_code (str) – The country code to download the shapefile for.

  • admin_level (int) – The admin level to download the shapefile for.

  • directory (str | Path | None) – The directory to download the shapefile to. If None, uses current directory.

  • timeout (int) – The timeout for the request.

Return type:

GADMShapefile

Returns:

A GADMShapefile instance for the downloaded shapefile.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].