Ticket #1114 (closed task: fixed)
[raster] ST_Resample
| Reported by: | dustymugs | Owned by: | dustymugs |
|---|---|---|---|
| Priority: | medium | Milestone: | PostGIS 2.0.0 |
| Component: | raster | Version: | trunk |
| Keywords: | history | Cc: |
Description
With the use of GDAL's warp API, a full set of different functions is needed to provide end-user functions. Therefore, the following function underlies all the other functions:
_ST_Resample( rast raster, srid integer DEFAULT NULL, scalex double precision DEFAULT 0, scaley double precision DEFAULT 0, upperleftx double precision DEFAULT NULL, upperlefty double precision DEFAULT NULL, skewx double precision DEFAULT NULL, skewy double precision DEFAULT NULL, algorithm text DEFAULT 'NearestNeighbour', maxerr double precision DEFAULT 0.125 ) -> raster
User-facing functions will provide needed validation before passing parameters to the above function.
As can be seen above, there is a "srid" parameter. The expectation is that ST_Transform will be refactored to call _ST_Resample.
The most comprehensive user function using _ST_Resample is:
ST_Resample( rast raster, srid integer DEFAULT NULL, scalex double precision DEFAULT 0, scaley double precision DEFAULT 0, upperleftx double precision DEFAULT NULL, upperlefty double precision DEFAULT NULL, skewx double precision DEFAULT NULL, skewy double precision DEFAULT NULL, algorithm text DEFAULT 'NearestNeighbour', maxerr double precision DEFAULT 0.125 ) -> raster
Parameters passed to ST_Resample will be validated to ensure that at least one of the srid, scale, upperleft and skew parameters are provided.
returns the resampled raster
srid: the SRID of the projection to use when reprojecting the raster
scalex: the resampled raster's scale in the X axis. default is 0 indicating that the user isn't specifying the resampled raster's scale
scaley: the resampled raster's scale in the Y axis. default is 0 indicating that the user isn't specifying the resampled raster's scale
upperleftx: the X component of the corner of the upper-left pixel of the resampled raster. default is NULL indicating that the user isn't realigning the raster
upperlefty: the Y component of the corner of the upper-left pixel of the resampled raster. default is NULL indicating that the user isn't realigning the raster
skewx: the X component of the resampled raster's skew. default is NULL indicating that the skew of the original raster will be applied to the the resampled raster
skewy: the Y component of the resampled raster's skew. default is NULL indicating that the skew of the original raster will be applied to the the resampled raster
algorithm: the resampling algorithm to use when resampling the raster. default is 'NearestNeighbour'. possible algorithms are:
NearestNeighbour (default. fastest performance but worst interpolation) NearestNeighbor (for those wanting to use the American spelling) Bilinear Cubic CubicSpline Lanczos
maxerr: the threshold for transformation approximation by the resampling algorithm (in pixel units). default is 0.125, which is the same value used in GDAL gdalwarp utility. if set to zero, no approximation takes place.
The other variant of ST_Resample is:
ST_Resample( rast raster, ref raster, algorithm text DEFAULT 'NearestNeighbour', maxerr double precision DEFAULT 0.125 ) -> raster
ref: the reference raster whose SRID, scale, upperleft coordinate and skew will be applied to the "rast" raster
Additional functions will be documented in following entries for this ticket.

