I'm trying to rasterize a linear shapefile in QGIS. Each linear feature has a count value attributed to it, so ideally I create a raster where each pixel has the summed count values from all lines that pass through that pixel (i.e. if two lines pass through a pixel, one with count = 50 and the other with count = 100, that pixel value will become 150). In R I can do this, but the process takes half a day so I want to know how to do this in QGIS.

The raster I produced in QGIS by "rasterizing" will not sum the count values of multiple lines: for example, there are two lines in a pixel, one has a 15,000 count and the other has a count of 20, so the raster pixel has a value of 20. Any advice?


Try another rasterizing tool "Rasterize (overwrite with attribute).

enter image description here

The tool seems to require that you have an existing image to be updated so you should create first an empty image. Alternatively you can use the gdal_rasterize https://gdal.org/programs/gdal_rasterize.html utility with -add option directly.


Instead of burning a new value, this adds the new value to the existing raster. Suitable for heatmaps for instance.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.