I have a line vector file and want to create raster file from it.
Here, the raster file's each pixel corresponds with shortest distance from the line.

How can I do it with QGIS ?

  • 2
    It is called proximity raster. First, rasterize your line vector. Then try Raster | Analysis | Proximity (Raster Distance) on that raster. – Kazuhito Apr 25 '17 at 3:02
  • Thank you for your reply. I rasterized line vector, but generated tiff was all black(zero values). When rasterizing, how should I set "Attribute field" ? I want "geometric" distance from line, so I don't care about attribute here though ... – Ichiro Apr 25 '17 at 15:33
  • Yes that is the tricky part. At the bottom of Rasterize (vector to raster) dialog window, GDAL command-line is displayed. After setting up raster size (or resolution), press the edit (pencil) button to make it editable. Then manually add -burn 100 -ot Byte (this 100 can be any value between 1-254) and run the tool. – Kazuhito Apr 25 '17 at 20:10
  • Thank you ! I tried "gdal_rasterize -burn 100 -ot Byte -ts 3000 3000 -l line" and "gdal_rasterize -burn 100 -ot Byte -a VALUE -ts 3000 3000 -l line", where VALUE is selected attribute field. But still get all blacks, zeros. What's wrong ? – Ichiro Apr 26 '17 at 0:19
  • 1
    Thank you ! "gdal_rasterize -burn 100 -ot Byte -tr 0.001 0.001 -l line" worked for me. Before doing that, I had to clip vector data, because it covered too big area. The above command didn't work for original big vector data. Anyway, problem was solved ! – Ichiro Apr 26 '17 at 22:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.