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

Rendering artifacts with linear interpolation in gdal_grid #638

Closed
moorglade opened this issue May 22, 2018 · 2 comments
Closed

Rendering artifacts with linear interpolation in gdal_grid #638

moorglade opened this issue May 22, 2018 · 2 comments
Assignees
Labels
Milestone

Comments

@moorglade
Copy link

Expected behavior and actual behavior.

I use gdal_grid and gdaldem to create a colorized GeoTIFF from simple .csv data files. In some cases, I observe strange rendering artifacts when using the linear interpolation algorithm.

For example, this is a correct (expected) rendering of a sample file using the nearest algorithm:

samples-nearest-colored

When I switch to the linear algorithm, I get unexpected rendering artifacts (notice the red bars at the top):

samples-linear-colored

Steps to reproduce the problem.

I uploaded example input files here.

  1. Generate GeoTIFF from samples.csv & samples.vrt:

    gdal_grid \
      -ot Float64 \
      -of GTiff \
      -txe 16.870876 19.691624 \
      -tye 54.980014 53.746311 \
      -outsize 682 512 \
      -a linear:radius=0.0:nodata=-9999.0 \
      samples.vrt samples.tiff
  2. Colorize the GeoTIFF file:

    gdaldem \
      color-relief \
      samples.tiff colormap samples-colored.tiff

Some other things I noticed:

  • this problem only happens for some specific map areas / input data sets
  • the artifacts are not present if I flip the output GeoTIFF by providing -tye parameters in the reverse order, i.e. -tye 53.746311 54.980014 instead of -tye 54.980014 53.746311 - so maybe the issue is somehow related to negative pixel dimensions

Operating system

Ubuntu 18.04 64 bit

I also replicated the problem inside a CentOS 7.4 Docker container.

GDAL version and provenance

GDAL 2.3.0 compiled from source.

@rouault
Copy link
Member

rouault commented May 23, 2018

Attaching input dataset here as bug638.zip

@moorglade
Copy link
Author

I don't know if it helps, but I did some debugging, and it seems the problem occurs when computing Delaunay triangulation coefficients in GDALTriangulationComputeBarycentricCoefficients.

Basically, there is a single triangle for which dfDenom is 0.0. The points of the triangle appear to be collinear:

  • P1 = (19.1864624, 54.9262161)
  • P2 = (19.2020874, 54.9262695)
  • P3 = (19.1942749, 54.9262428)

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

No branches or pull requests

2 participants