I have polygons that is converted from raster dataset with Raster Pixels to Polygons in QGIS. I would like select some polygons based on the attribute value and merge them using Dissolve function in Geopandas. However, GeoPandas Dissolve function doesn't work as I have different values for each polygon and Dissolve function requires by = "VALUE" which doesn't allow merge adjacent polygons. I found an answer in Dissolve not based on attribute in GeoPandas?
a4 = gpd.read_file("grids.shp") a4 = a4[a4['VALUE']<= 0.28] #selecting values smaller than 0.28 a4_dissolved = gpd.geoseries.GeoSeries([geom for geom in a4.unary_union.geoms]) #dissolving a4_dissolved.to_file("a4_dissolved.shp")
However, it creates parallel strips of polygons like the image below, and output file doesn't have coordinate system:
Can anyone please help to resolve this problem?