Recipe: Importing GeoJSON into Shapely

Importing GeoJSON into Shapely is incredibly easy. Here’s how it can be done:

If you run this in a Jupyter Notebook cell, Shapely will draw a small (SVG?) picture of it in the cell output.

The world being what it is, and given that GIS data is involved, chances are the GeoJSON file wont be in a convenient projection. Converting it can be done using pyproj like so (as reported in the Shapely docs):

Example Result:

Like what you read? Give Pramukta Kumar a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.