Miguel, I can't seem to find this in the docs, but I think what you want is "MERGE_ALG" set to ADD instead of the default REPLACE.
https://github.com/OSGeo/gdal/blob/master/gdal/alg/gdalrasterize.cpp#L1165 This doesn't address the buffering (I guess you might still want to buffer the whole set), but it should take care of the additive step. I actually implemented this as part of a programming test for my current job - to build heatmaps of satellite coverage. Best regards, Frank On Tue, May 4, 2021 at 1:30 PM Miguel A. Manso <m.ma...@upm.es> wrote: > 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. > > Regards > Miguel A. Manso > > > _______________________________________________ > gdal-dev mailing list > gdal-dev@lists.osgeo.org > https://lists.osgeo.org/mailman/listinfo/gdal-dev > -- ---------------------------------------+-------------------------------------- I set the clouds in motion - turn up | Frank Warmerdam, warmer...@pobox.com light and sound - activate the windows | +1 650-701-7823 and watch the world go round - Rush | Geospatial Software Developer
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev