Skip to content

Instantly share code, notes, and snippets.

View docuracy's full-sized avatar

Stephen Gadd docuracy

View GitHub Profile
@docuracy
docuracy / GeometryCollections-to-MultiPolygons.py
Created October 18, 2025 06:31
Convert GeometryCollections to MultiPolygons to facilitate visualisation in QGIS. Any Point or Line geometries are dropped.
import json
import requests
from shapely.geometry import shape, mapping, MultiPolygon, GeometryCollection
# --- Fetch JSON from GitHub ---
URL = "https://raw.githubusercontent.com/periodo/periodo-places/2b0e7c9db27ada2fa9a73ab7e9a222b27ee827f2/gazetteers/subregions.json"
print(f"Fetching data from {URL} ...")
r = requests.get(URL)
r.raise_for_status()
data = r.json()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.