Changes between Version 46 and Version 47 of WKTRaster/SpecificationWorking03


Ignore:
Timestamp:
03/25/11 13:12:24 (14 years ago)
Author:
pracine
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • WKTRaster/SpecificationWorking03

    v46 v47  
    197197
    198198----
    199 == '''Objective FV.03 - Being able to use neighbour pixels in !MapAlgebra expressions.''' ==
     199== '''Objective FV.03 - Implement all the necessary version of ST_MapAlgebra''' ==
     200
     201Different versions of ST_MapAlgebra are planned...
     202
     203One raster versions:
     204
     2051) '''ST_MapAlgebraExpr() -''' A one raster version taking an '''expression''' of one pixel at a time. Already implemented...
     206
     2072) '''ST_MapAlgebraFct() -''' A one raster version taking a '''user defined function''' (with optional parameters) of one pixel at a time. The function is a user defined PL/pgSQL function taking a float8 value and returning a value. Code was developped by David Zwarg, needs to be integrated in the source tree. This version is much faster than 1) but requires the user to write a PL/pgSQL function.
     208
     2093) '''ST_MapAlgebraFctNgb() -''' A one raster version taking a '''user defined function''' (with optional parameters) of the set of first, second, etc... '''neighbours''' of a pixel. The function is a user defined PL/pgSQL function taking a matrix containing the neighbour values and returning one value. Code do not exist yet but will be very much similar to 2). Out of bound pixels values are set to NULL. This version requires the user to write a PL/pgSQL function. Many predefined function should be delivered.
     210
     2114) '''ST_MapAlgebraFctNgb() -''' A one raster version taking a '''table name and a raster column name''' (in order to work on a '''tiled coverage''') and a '''user defined function''' (with optional parameters) of the set of first, second, etc... '''neighbours''' of a pixel. The passed matrix should include values for out of bound pixels taken from neighbour tiles.
     212
     213Two rasters versions. These versions must take into account different alignment, different extents, nodata and non-existent values.
     214
     2155) '''ST_MapAlgebraExpr() -''' A two rasters version taking an expression of two pixels at a time, one from each rasters.
     216
     2176) '''ST_MapAlgebraExpr() -''' A two rasters version taking a '''table name and a raster column name''' (in order to work on a '''tiled coverage''') and an expression of two pixels at a time, one from each rasters.
     218
     2197) '''ST_MapAlgebraFct() -''' A two rasters version taking a '''user defined function''' (with optional parameters) of two pixels at a time, one from each rasters. The function is a user defined PL/pgSQL function taking two float8 values and returning one value.
     220
     2218) '''ST_MapAlgebraFct() -''' A two rasters version taking a '''table name and a raster column name''' (in order to work on a '''tiled coverage''') and a '''user defined function''' (with optional parameters) of two pixels at a time, one from each rasters. The function is a user defined PL/pgSQL function taking two float8 values and returning one value. Non-existent values are found in the neighbour tiles when possible.
     222
     223
     224
     225'''Details for 3) ST_MapAlgebraFctNgb()'''
    200226
    201227For now ST_MapAlgebra expressions refer only to the pixel being computed. e.g. "rast * 100". The original plan was to allow refering to neighbour pixels using two coordinated relative to the pixel being computed. e.g. "rast[-1,0] * 100" where rast[-1,0] refer to the value of the pixel one pixel to the left of the pixel being computed. However this syntax might prove to be hard to use when many neighbours are to be used.
     
    237263
    238264See also: [wiki:WKTRaster/MapAlgebra Notes taken by David Zwarg during the Montreal Code Sprint 2011] and http://trac.osgeo.org/postgis/ticket/860
     265
     266
     267
     268'''Details for 5) to 8) Two rasters versions'''
     269
     270These function must first determine if a resampling of one raster is necessary:
     271
     272'''ST_SameAlignment(raster, raster)'''
     273
     274 This function returns true if both rasters' grids are aligned.
     275
     276 Two rasters grid are aligned if:
     277
     278  -They share the same pixel scales and skews
     279
     280  -At least one of any of the four corner of any pixel of one raster fall on any corner of the grid of the other raster.
     281
     282 Alignment is not the same concept as georeference. Two rasters can be aligned but not have the same georeference.
     283
     284 Rotation is important here since two rasters grid might look perfectly aligned but are not if their rotated are different.
     285
     286 Knowing if two rasters share the same alignment is useful when it is time to decide if one of them must be resampled before doing other operations (like ST_MapAlgebra on two rasters).
     287
     288 '''Variants'''
     289
     290  1) ST_SameAlignment(ulx1, uly1, scalex1, scaley1, skewx1, skewy1, ulx2, uly2, scalex2, scaley2, skewx2, skewy2)
     291
     292  2) ST_SameAlignment(rast1 raster, rast2 raster)
     293
     294 The first variant is useful to PL/pgSQL function which have already get the values of the parameters.
     295
     296 '''Implementation Details'''
     297
     298 Only the first variant should be implemented in C. The second one is a PL/pgSQL variants. The C implementation should follow the PL/pgSQL version implemented in http://trac.osgeo.org/postgis/browser/trunk/raster/scripts/plpgsql/st_mapalgebra.sql
     299
     300 It is not clear if this PL/pgSQL implementation works when raster are rotated. To verify.
     301
     302 See discussion in http://trac.osgeo.org/postgis/ticket/589
     303
     304 
     305'''ST_MapAlgebra on two rasters'''
     306
     307 Specifications of ST_MapAlgebra on two rasters are still in progress as a new optimised version, filling large areas of same value more quickly, is planned. See http://trac.osgeo.org/postgis/browser/trunk/raster/scripts/plpgsql/st_mapalgebra_optimized.sql
     308
     309 See discussion in http://trac.osgeo.org/postgis/ticket/590
     310
    239311----
    240312== '''Objective FV.04 - Being able to use "group by" to accumulate tiles to form a new raster.''' ==