GeoJSON convert Polygons and MultiPolygons to LineStrings and MultiLineStrings

by beaorn   Last Updated December 01, 2017 01:22 AM

Is there a gdal or python based tool for converting Polygons and MultiPolygons inside of GeoJSON to LineStrings and MultiLineStrings? I'm using rasterio / rio rasterize or gdal_rasterize to rasterize GeoTIFF w/ GeoJSON.

I need to read in GeoJSON files and be able to convert any (Multi)Polygons into LineStrings and MultiLineStrings so I can rasterize just the "boundary" or "exterior" of the (Multi)Polygons onto GeoTIFFs and not have it fill in the entire shape. If there is a way to rasterize just the exterior of the polygons without needing to convert to linestrings, I'm fine with that too.

Any ideas?

Related Questions

Convert GeoJSON FeatureCollection into Multipolygon

Updated August 15, 2018 21:22 PM

Masking a list of geojson features Rasterio

Updated May 12, 2017 15:22 PM

Crop a raster using rasterio and geopandas

Updated July 11, 2017 00:22 AM