You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a MEAN (or AVERAGE) option to the papszOptions parameter in GDALRasterizeGeometries, which would compute the mean value of the geometries located within a grid cell.
In its current state, the only way to do this using GDAL (or one of its many downstream projects such as rasterio), is to circuitously rasterize using ADD and then divide by a second raster containing number of intersecting points.
Additional context
When rasterizing vector geometries, especially point observations, is a common operation in environmental geoscience. Often, when rasterizing points, the average value of the points contained within a grid cell is needed. In this instance, the currently available options for MERGE_ALG don't really suffice. For example, when rasterizing a set of land surface temperature observations, the ADD option doesn't make sense and the REPLACE option discards valuable information.
Admittedly my C knowledge is minimal, so I'm not comfortable submitting a PR. Is there a more fundamental reason why this seemingly commonplace operation was omitted in the first place?
The text was updated successfully, but these errors were encountered:
Rasterize does not only create a new raster but it can also update existing pixels. A pixel in an image does not know its history. GDAL can ADD a value to existing value 4+2=6, but GDAL cannot know why the original value was 4, and the image cannot tell it either. It can be the initial value, or average of 2 or 3 or whatever.
Feature description
Add a
MEAN
(orAVERAGE
) option to thepapszOptions
parameter inGDALRasterizeGeometries
, which would compute the mean value of the geometries located within a grid cell.In its current state, the only way to do this using GDAL (or one of its many downstream projects such as
rasterio
), is to circuitously rasterize usingADD
and then divide by a second raster containing number of intersecting points.Additional context
When rasterizing vector geometries, especially point observations, is a common operation in environmental geoscience. Often, when rasterizing points, the average value of the points contained within a grid cell is needed. In this instance, the currently available options for
MERGE_ALG
don't really suffice. For example, when rasterizing a set of land surface temperature observations, theADD
option doesn't make sense and theREPLACE
option discards valuable information.Admittedly my C knowledge is minimal, so I'm not comfortable submitting a PR. Is there a more fundamental reason why this seemingly commonplace operation was omitted in the first place?
The text was updated successfully, but these errors were encountered: