85 | | |
86 | | ---- |
87 | | == '''Objective 2.0.03 - Being able to create a raster as the expression of two rasters''' == |
88 | | |
89 | | '''ST_SameAlignment(raster, raster)''' |
90 | | |
91 | | This function returns true if both rasters' grids are aligned. |
92 | | |
93 | | Two rasters grid are aligned if: |
94 | | |
95 | | -They share the same pixel scales and skews |
96 | | |
97 | | -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. |
98 | | |
99 | | Alignment is not the same concept as georeference. Two rasters can be aligned but not have the same georeference. |
100 | | |
101 | | Rotation is important here since two rasters grid might look perfectly aligned but are not if their rotated are different. |
102 | | |
103 | | 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). |
104 | | |
105 | | '''Variants''' |
106 | | |
107 | | 1) ST_SameAlignment(ulx1, uly1, scalex1, scaley1, skewx1, skewy1, ulx2, uly2, scalex2, scaley2, skewx2, skewy2) |
108 | | |
109 | | 2) ST_SameAlignment(rast1 raster, rast2 raster) |
110 | | |
111 | | The first variant is useful to PL/pgSQL function which have already get the values of the parameters. |
112 | | |
113 | | '''Implementation Details''' |
114 | | |
115 | | 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 |
116 | | |
117 | | It is not clear if this PL/pgSQL implementation works when raster are rotated. To verify. |
118 | | |
119 | | See discussion in http://trac.osgeo.org/postgis/ticket/589 |
120 | | |
121 | | |
122 | | '''ST_MapAlgebra on two rasters''' |
123 | | |
124 | | 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 |
125 | | |
126 | | See discussion in http://trac.osgeo.org/postgis/ticket/590 |