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

FillSingleCellPits creates problematic (NODATA + 1) values on raster edges #435

Open
geotom opened this issue Nov 21, 2024 · 0 comments
Open

Comments

@geotom
Copy link

geotom commented Nov 21, 2024

Problem

We observed that the FillSingleCellPits method algorithm is flawed, when the kernel window works along raster edges.
The result is an elevation raster, which has line artefacts on the raster edge (where a flattened lake creates same values).

Some visual explanations

Flattened lake with same elevation (370m)

image

Line artefacts caused by FillSingleCellPits

image

Code

The problematic part in the code is happening in line 222 (fill_pits.rs)

for n in 0..8 {
    zn = input.get_value(row + dy[n], col + dx[n]);
    if zn < min_zn {
        min_zn = zn;
    }
    if zn != nodata && zn < z {
        flag = false;
        break;
    }
}

Solution

A new min value for the observed raster window should only be set, when the pixel value is not NODATA (in this case outside of the raster bounds)

line 222: if zn != nodata && zn < min_zn {

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