Skip to content
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 behavior change between 3.8.4 and 3.9.0 #10854

Open
madsvlad2 opened this issue Sep 20, 2024 · 0 comments
Open

gdal_contour behavior change between 3.8.4 and 3.9.0 #10854

madsvlad2 opened this issue Sep 20, 2024 · 0 comments

Comments

@madsvlad2
Copy link

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 by gdaldem. 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

90488694-highlight-gdal-3 7 2

Tile B

90488692-highlight-gdal-3 7 2
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

90488694-highlight-gdal-3 9 0

Tile B

90488692-highlight-gdal-3 9 0

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:
90488692-90488694-hillshade-raster-overlap

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant