[gdal-dev] About gdal RasterizeLayer

Frank Warmerdam warmerdam at pobox.com
Tue May 4 11:07:16 PDT 2021


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.manso at 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 at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>


-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam,
warmerdam at pobox.com
light and sound - activate the windows | +1 650-701-7823
and watch the world go round - Rush    | Geospatial Software Developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210504/2022e85d/attachment.html>


More information about the gdal-dev mailing list