Download Gadm Data -version 3.6- -
url = urls[country_code] output_dir = "gadm_data_v3.6" os.makedirs(output_dir, exist_ok=True)
if country_code not in urls: print(f"URL for {country_code} not found. Please check country code.") return None download gadm data -version 3.6-
print(f"Downloading from {url}") response = requests.get(url, stream=True) url = urls[country_code] output_dir = "gadm_data_v3
# Load the GeoPackage gpkg_path = os.path.join(output_dir, f"gadm36_{country_code}.gpkg") gdf = gpd.read_file(gpkg_path, layer=str(level)) f"gadm36_{country_code}.gpkg") gdf = gpd.read_file(gpkg_path
with zipfile.ZipFile(zip_path, 'r') as zip_ref: zip_ref.extractall(output_dir)









