[postgis-devel] [PostGIS] #1268: [raster] ST_MapAlgebraExpr for 2 rasters

PostGIS trac at osgeo.org
Mon Nov 7 11:27:28 PST 2011


#1268: [raster] ST_MapAlgebraExpr for 2 rasters
----------------------------+-----------------------------------------------
 Reporter:  dustymugs       |       Owner:  dustymugs    
     Type:  task            |      Status:  assigned     
 Priority:  medium          |   Milestone:  PostGIS 2.0.0
Component:  postgis raster  |     Version:  trunk        
 Keywords:                  |  
----------------------------+-----------------------------------------------

Comment(by bnordgren):

 Replying to [comment:4 dustymugs]:
 > I set "expression" to default to NULL as we don't want to make any
 assumptions for the end user.  Setting the "expression" to "rast1 + rast2"
 is no better to me than using "1" or "255" as the function doesn't know
 what the user wants.  So, NULL is the default, which means for two pixels
 of the same coordinates the output pixel's value will be set to NODATA.

 I think I was unclear. I meant to suggest that because the function cannot
 make assumptions about what the user wants, it should fail if the user
 doesn't specify an expression. Besides, failing to specify an expression
 is not the same thing as specifying an expression which says "RETURN
 NULL".

 In any case, if the user didn't specify an expression, they probably
 didn't specify a nodata value, so it is highly unlikely that you're going
 to know enough to be able to set the pixels to NODATA.

 Also, I cannot think of a compelling reason to represent the nodata
 constant value as an expression. Nodata is already defined as a numeric
 value for the chosen bands, and is a value (not an expression). If we
 represent it as an expression, it must evaluate to a constant which
 applies uniformly to all pixels in the band. Let's allow Postgresql to
 ensure that it does. Users can still write 2+4 if they feel like it.

 If we wanted to not fail for lack of information, it seems to me that a
 minimum set of defaults would be:
 {{{
 ...
   expression text DEFAULT "return NULL", ...
   nodatanodataexpr REAL DEFAULT 0
 ...
 }}}

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/1268#comment:6>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-devel mailing list