89 | | This function returns true if both raster grid are aligned. |
90 | | |
91 | | For two raster to be aligned they must: |
92 | | |
93 | | -Share the same pixel scale and skew |
94 | | |
95 | | -At least one of any of the four corner of any pixel must fall on on any corner of the grid of the other raster. |
96 | | |
97 | | Alignment is not the same concept as georeference. Two raster might be aligned but not have the same georeference. |
98 | | |
99 | | To know if two rasters share the same alignment is useful to decide if we must resample one of them before doing another operation (like MapAlgebra on two rasters). |
100 | | |
| 89 | This function returns true if both rasters' grids are aligned. |
| 90 | |
| 91 | Two rasters grid are aligned if: |
| 92 | |
| 93 | -They share the same pixel scales and skews |
| 94 | |
| 95 | -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. |
| 96 | |
| 97 | Alignment is not the same concept as georeference. Two rasters can be aligned but not have the same georeference. |
| 98 | |
| 99 | Rotation is important here since two rasters grid might look perfectly aligned but are not if their rotated are different. |
| 100 | |
| 101 | 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). |
| 102 | |
| 103 | '''Variants''' |
| 104 | |
| 105 | 1) ST_SameAlignment(ulx1, uly1, scalex1, scaley1, skewx1, skewy1, ulx2, uly2, scalex2, scaley2, skewx2, skewy2) |
| 106 | |
| 107 | 2) ST_SameAlignment(rast1 raster, rast2 raster) |
| 108 | |
| 109 | The first variant is useful to PL/pgSQL function which have already get the values of the parameters. |
| 110 | |
| 111 | '''Implementation Details''' |
| 112 | |
| 113 | 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/spike/wktraster/scripts/plpgsql/st_mapalgebra.sql |
| 114 | |
| 115 | It is not clear if this PL/pgSQL implementation works when raster are rotated. To verify. |
| 116 | |
| 117 | |