-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
gdal_contour generates polygon for value not specified in fixed levels #11564
Comments
CC @elpaso |
@rouault I have looked to the issue and I have wrote a reproducer test and a patch to fix the issue, but the patch breaks other tests (test_contour_3) and therefore I am not convinced that this is an actual bug but perhaps a documentation issue. Looking at the the code and the tests it seems that the polygonize option is expected to create polygons that include all pixels that are between a range of values, the fixed levels define the upper value of the ranges and the minimum value of the first range is taken from the raster's minimum value, that would be If you believe that this is a bug, I can submit the patch and rewrite the test_contour_3 to behave accordingly and complete the documentation of the utility and the library function to match the new behavior. |
yes, I can see it makes sense from a coding point of view, but it is also a bit counter-intuitive from a user point of view. e.g. given test.asc with:
What is a bit tricky is when the user specify both -i and -fl. Currently this does
and I believe this should still behave the same. So the change should only be done if "-p" and "-fl" are specified, but not when "-i" or "-e" are specified It would be good to add numerous examples (e.g. using above example) in the documentation to explain the subtelties. |
What is the bug?
When using gdal_contour and specifying fixed levels to contour, it seems to output the lowest value in the raster data regardless of the fixed levels specified in the command.
Steps to reproduce the issue
Using the supplied grib2 file (unzip it first), run the following command
gdal_contour -p -amin value -fl 20 22 22 24 26 28 30 32 34 36 38 40 44 48 52 56 60 64 68 72 76 80 ./base-ref.grib2 ./base-ref.json
The output JSON will have all the fixed levels, but will contour the lowest value in the grib file (-10) which drastically bloats the output.
base-ref.grib2.zip
Versions and provenance
Mac OS: 15.0
GDAL 3.10.0, released 2024/11/01
Additional context
No response
The text was updated successfully, but these errors were encountered: