New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GDALPolygonize doesn't vectorize all pixels C++ #8001
Comments
The reason is that you pass the rasterBand itself as the value for the maskBand argument of GDALPolygonize(), which cause pixels at 0 to be considered invalid.
|
I thought that passing the same raster band again would act as the mask band? |
nothing in the docs suggest so: https://gdal.org/api/gdal_alg.html#_CPPv414GDALPolygonize15GDALRasterBandH15GDALRasterBandH9OGRLayerHiPPc16GDALProgressFuncPv |
Fair point. I did test it and it does seem to be working on the small dataset I provided. Thanks for your help! |
Expected behavior and actual behavior.
I expect the GDALPolygonize function to take in a raster file and return a vector file that covers all of the pixels in the input.
Steps to reproduce the problem.
Here is the high level of what I am doing:
Here is the code I am running:
I have attached the raster file I used and the output file I get from running the above code. GitHub doesn't allow me to upload .tif files, so I have added it in a zip file.
The picture below is what I see in QGIS. The pink color is the polygons and the black is the raster representation. As you can see there the black pixels were not polygonized.
Operating system
WSL2
Ubuntu 20.04.2 LTS
GDAL version and provenance
GDAL 3.5.3, released 2022/10/21
chunked_test_chunk_16.zip
The text was updated successfully, but these errors were encountered: