Closed madsvlad2 closed 1 month ago
I can reproduce the issue, I noticed another difference between master (which I am testing) and 3.8, the level of 3.8.4 at the clicked coordinates (outside the 239 and 245 polys) is 0, while it is 198 in 3.9 and master
The issue appeared after https://github.com/OSGeo/gdal/commit/bbb989d7162a1c40d6fa70dca185efeaf59e3709
What is the bug?
It appears
gdal_contour
behavior has changed somewhere between 3.8.4 and 3.9.0. I am generating hillshade polygons from hillshade raster images generated bygdaldem
. In my application, the world is cut into tiles and it is important that the hillshade polygons match across tile boundaries. To accomplish this, the hillshade raster image for a tile overlaps with its neighbor tile images by 8 pixels to ensure continuity (that's a total of 16 overlapping pixels between any two neighbors).This all worked fine until I upgraded to GDAL 3.9.0. The images below illustrate the differences:
Here is the output of
gdal_contour
with version 3.8.4 near the boundary between two tiles where tile A is north of tile B:Tile A
Tile B
You can see that the polgons generated in the overlapping border areas between the tiles are identical
Here is the output of
gdal_contour
with version 3.9.0 in the same region:Tile A
Tile B
Here Tile A polygons are different. Note that the small polygon (gold in Tile B) is generated, but is classified to a different level than in Tile B.
In the images above, the two white dots represent points along the edge between the tiles where they will eventually be cut.
Both sets of data were generated off the same two hillshade raster images:
You can see in the image above, that there is overlap between the neighboring hillshade raster images. In the picture one of the images was turned red and made slightly transparent. I have verified that the images are pixel-for-pixel equal in the overlap region.
Steps to reproduce the issue
Attached is a zip file containing a bash script, the two source hillshade raster images and the generated hillshade polygons from each GDAL version. You should be able to modify the bash script to point to where the different GDAL binary versions are located on your computer to run the script. The script also illustrates how
gdal_contour
is being called.gdal_contour_issue.zip
Versions and provenance
Ubuntu 24.04 GDAL version 3.9.0
Additional context
No response