I need to convert some binary shapes that are in an image/array, but some of them have holes. I found this code for a basic conversion: from rasterio import features from shapely.geometry import mapping from shapely.geometry import shape as Shape results = [] shapes = features.shapes(image, mask=image==1) for geom, value in shapes: results.append({"type": "Feature", "properties": "...Some Properties...", "geometry": mapping(Shape(geom))}) result = {"type": "FeatureCollection",c"features": results} However this code does not support holes in the shape. If a shape contains a hole, the results is a geojson where the holes have been filled. How can I improve my code to support shape with holes? Continue reading...