Skip to content

Instantly share code, notes, and snippets.

@simboli
Created November 7, 2022 09:42
Show Gist options
  • Save simboli/ff57bff0c1412a2437e07cf10d56967f to your computer and use it in GitHub Desktop.
Save simboli/ff57bff0c1412a2437e07cf10d56967f to your computer and use it in GitHub Desktop.
geoJson loader Shapely 2.0
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import json
from shapely.geometry import MultiPolygon, Poing, shape
bound_multply = []
bound_names = []
geoJsonFileName="Ariccia.geojson"
with open(fname, encoding="utf-8") as geoJsonFile:
GeoData = json.load(geoJsonFileName)
for bound in GeoData['features']:
if bound.get('properties').get('type')=='boundary':
bound_shape = shape(bound['geometry'])
bound_multply.append(bound_shape)
bound_names.append(bound['properties']['name'])
bound_polygon = MultiPolygon(bound_multply)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment