with zipfile.ZipFile(zip_path, 'r') as zip_ref: zip_ref.extractall(output_dir)

print(f"Downloading from {url}") response = requests.get(url, stream=True)

with open(zip_path, 'wb') as f: for chunk in response.iter_content(chunk_size=8192): f.write(chunk)

# Load the GeoPackage gpkg_path = os.path.join(output_dir, f"gadm36_{country_code}.gpkg") gdf = gpd.read_file(gpkg_path, layer=str(level))