[gdal-dev] About gdal RasterizeLayer

Miguel A. Manso m.manso at upm.es
Tue May 4 10:11:48 PDT 2021

Dear all

I have a multiline layer type (tracking) and I want to make a heat map 
(densities) on a buffer of them, so that in those places where several 
buffers overlap the density is added as many times as lines overlap.

Now I'm doing it with a python script that reads from a shp the lines, 
generates a buffer and rasterize the polygon filling it with a given 
value with gda.RasterizeLayer(). I read the image as an array and with 
numpy I add it to another array (accumulating). When I finish I convert 
it to an image and save it in a geotiff.

This procedure is relatively slow. Especially if you have to do it for 
many lines.

My question is along the lines of whether the RasterizeLayer function 
itself could do this process in a more efficient way, making the burning 
of the objects not an OR operation but an arithmetic sum...

Any suggestions would be welcome.

Miguel A. Manso

More information about the gdal-dev mailing list