Get Polygon from Isochrone

Hi there,

first of: Thank you for your great service!

I am looking for a way to turn an isochrone into a polygon that I can manipulate using python and the shapely library. Can you give me a glue how to do this?

Thanks in advance!

Hi @bagdenaj,

first of all, have a glue
https://images.app.goo.gl/QFmVUNhzKqL9v4CS6.

Our isochrones are returned as GeoJSON Feature collection of Polygons.
For the next bit just take a look at the shapely docs:

Best regards

1 Like

Hey there,

thanks for the glue. Thats one impressive glue!

However the shapely doc didnt’t help much.

I get the following error:

poly1 = shape(iso)

geo.py 116 shape
raise ValueError("Unknown geometry type: %s" % geom_type)

ValueError:
Unknown geometry type: featurecollection

Seems like featurecollection isn’t supported by shapely. What can I do about that?

Best regards

Hey,

You can of course ask the shapely-team to fully support GeoJSON-conversion, i.e. Features and FeatureCollections. This is probably done at their github page.

Any further questions regarding shapely should be directed towards their GIS stackexchange.

As to give a more direct course of action, any GeoJSON-FeatureCollection will contain features, any GeoJSON-Feature will contain a geometry), every GeoJSON-Geometry will contain a type and geometry and the shapely.geometry.shape() function takes exactly this.

Therefore, something like shape(iso['features'][0]['geometry']) should work and yield a valid shape.

Best regards,
Jakob

1 Like