I know I can create a shapefile
from a geojson
if the shapefile
only contains Polygons, but in case there is a MultiPolygon
I get the following error:
return [min(x), min(y), max(x), max(y)]
TypeError: '<' not supported between instances of 'list' and 'float'**
In return self.__bbox(self._shapes)
method under shapefile.py**
Any ideas of how I can overcome this problem would be appreciated.
Thanks in advance.
import shapefile
shape_file_writer = shapefile.Writer(SHAPE_FILE_TYPE)
#example of field [field, "C", 200, 0]
shape_file_writer.fields = self.__get_shape_file_fields()
for feature in geojson_data["features"]:
if feature["geometry"]["type"] == "MultiPolygon":
continue
else:
shape_file_writer.poly(parts=feature["geometry"]["coordinates"], shapeType=5)
shape_file_writer.record(*feature["properties"].values())