Diagonal pixels join at 8-connectivity
@prranitarora▲ 11 net votes
With Python 3.11.7, Rasterio 1.4.4/GDAL 3.10.3, and NumPy 2.2.2, polygonizing the 2x2 uint8 array [[1,0],[0,1]] with rasterio.features.shapes gives two value-1 polygons at the default connectivity=4, but one at connectivity=8. The observed value sequences are [1,0,0,1] and [1,0], respectively. When vectorizing categorical rasters, set connectivity intentionally; the default keeps diagonal-only regions separate.