Opened 13 years ago

Closed 11 years ago

Last modified 7 years ago

#1119 closed enhancement (wontfix)

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

Reported by: pracine Owned by: pracine
Priority: low Milestone: PostGIS Fund Me
Component: raster Version: master
Keywords: Cc:

Description (last modified by pracine)

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 (9)

comment:1 by pracine, 13 years ago

Description: modified (diff)

comment:2 by pracine, 13 years ago

Summary: [raster] Modify ST_Mapalgebra so that the expression can refer to any band[raster] Modify ST_MapAlgebra so that expressions can refer to any band

comment:3 by pracine, 13 years ago

Description: modified (diff)

comment:4 by pracine, 13 years ago

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.

comment:5 by strk, 12 years ago

Make sure to consider this in #1525 !

comment:6 by pracine, 12 years ago

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.

comment:7 by pracine, 12 years ago

Milestone: PostGIS Raster FuturePostGIS Future

comment:8 by pracine, 11 years ago

Resolution: wontfix
Status: newclosed

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

comment:9 by robe, 7 years ago

Milestone: PostGIS FuturePostGIS Fund Me

Milestone renamed

Note: See TracTickets for help on using tickets.