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_rasterize with -add introduces additional values in the output #1307

Closed
ricardogsilva opened this issue Feb 21, 2019 · 0 comments
Closed

Comments

@ricardogsilva
Copy link

Expected behavior and actual behavior.

I'm trying to use gdal_rasterize with a bunch of linestrings as input. I want the output raster to be burned with the sum of each linestring and I also want it to be burned on all pixels that touch the linestrings. I am using the following incantation:

 gdal_rasterize \
    -burn 1 \
    -at \
    -add \
    -tr 1000 1000 \
    -ot Int16 \
    ~/test_rasterization.gpkg ~/burn_test_gdal_rasterize.tif

The outcome does not match what I expected. Here is a picture of the files loaded in QGIS:

gdal_rasterize

In the image above, the red line represents my vector linestring. The raster is shown below the line. I would expect the raster to be made of only the values 0 and 1. However, I see that the lighter gray areas have the value 2. Since a single feature has been burned, it seems to me that the value 2 should never be a part of the raster.

Steps to reproduce the problem.

Operating system

Ubuntu 18.04 64 bit

GDAL version and provenance

2.2.3 from the main ubuntu repos

rouault added a commit that referenced this issue Feb 22, 2019
Rasterize with MERGE_ALG=ADD: avoid burning several times intermediate points of linestrings (fixes #1307)
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