I have raster dataset that I would like to convert into vector polygons. Raster to polygon conversion works pretty good. But, having problem when I try to merge adjacent polygons using Dissolve function in Geopandas. Gaps inside polygons are automatically filled which I don't want as I want to use those gaps in further analysis. Is there a way to avoid automatically filling gaps? Here is a simple code:

shp = gpd.read_file("file.shp")
shp_dissolved = shp.dissolve(by="VALUE")

Input image:

enter image description here

Output image:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.