Ticket #1119 (closed enhancement: wontfix)

Opened 23 months ago

Last modified 6 months ago

[raster] Modify ST_MapAlgebra so that expressions can refer to any band

Reported by: pracine Owned by: pracine
Priority: low Milestone: PostGIS Future
Component: raster Version: trunk
Keywords: Cc:

Description (last modified by pracine) (diff)

This could be useful for:

-Writing expressions (like 'average') involving any band of the raster

-Refer to weighted information created by ST_AsRaster() (the length or the area of the geometry intersecting with the pixel

In the one raster version of MapAlgebra? one could refer to the second band like this: 'rast[2]'.

In the two rasters version of MapAlgebra? one could refer to the second band like this: 'rast1[2] + rast2[2]'.

'rast', 'rast1' and 'rast2' should by default refer to the value of the first band.

Out of bound band references should be clamped to the existing band range.

This change means that we MUST remove the function's band parameters since they are not useful anymore.

Change History

Changed 23 months ago by pracine

  • description modified (diff)

Changed 23 months ago by pracine

  • summary changed from [raster] Modify ST_Mapalgebra so that the expression can refer to any band to [raster] Modify ST_MapAlgebra so that expressions can refer to any band

Changed 23 months ago by pracine

  • description modified (diff)

Changed 23 months ago by pracine

Important to note that as soon as references are made to other band than 1, nodata value alternative expressions should be used when ANY of the raster value used in the expression is nodata. E.g. if the expression is 'rast1[2] + rast1[1] * rast2' in the two rasters ST_Mapalgebra(), then 'nodata1expr' is used instead of 'expression' as soon as one of 'rast1[2]' OR 'rast1[1]' is nodata and 'nodatanodataexpr' is used as soon as ('rast1[2]' OR 'rast1[1]' is nodata) AND 'rast1[1]' is nodata.

Changed 16 months ago by strk

Make sure to consider this in #1525 !

Changed 16 months ago by pracine

This is a big change that we should definitely be postpone to future version.

-It requires to remove the band parameter to every sT_MapAlgebra: since we can invoke any band in the expression, there is no need to pass a band number to the function.

-As commented previously in this ticket, it drastically changes the meaning of the nodata alternate expression. The nodata expressions are there to tell what to do when the pixel iterator meet a nodata value. If there is no more band parameter, which pixel of which band we must consider as a nodata value?

I think more and more that the way ST_MapAlgebra was designed must stick with dealing with one band at a time. We should design new map algebra function to deal with 1) expressions referencing multiple bands (this is the possibility invoked in this ticket) and 2) map algebra for multiple band raster applying the same expression to every bands of a raster.

So please think twice before implementing this feature. We need new ST_MapAlgebra variants with specific behaviors.

Changed 15 months ago by pracine

  • milestone changed from PostGIS Raster Future to PostGIS Future

Changed 6 months ago by pracine

  • status changed from new to closed
  • resolution set to wontfix

I'm closing this ticket since the functionality required is now possible with n-raster ST_MapAlgebra (#2030).

Note: See TracTickets for help on using tickets.