Changes between Version 148 and Version 149 of WKTRaster/SpecificationWorking03

Show
Ignore:
Timestamp:
07/14/11 16:05:25 (2 years ago)
Author:
dustymugs
Comment:

ST_Resample, ST_Rescale, ST_Reskew, ST_SnapToGrid

Legend:

Unmodified
Added
Removed
Modified
  • WKTRaster/SpecificationWorking03

    v148 v149  
    401401'''ST_ValuePercent(raster, value) -> double precision - done see below''' 
    402402 
    403 '''ST_Resample(raster, method, originx, originy, pixelsizex, pixelsizey) -> raster''' 
    404  
    405  * Implemented as a wrapper around GDAL like done for ST_DumpAsPolygons() 
    406  * Resampling methods are the same as the one priovided by GDAL 
    407  
    408  '''Variants''' 
    409  
    410  * The '''first series of variants''' only change the pixelsize of the raster. 
    411  
    412  1) ST_Resample(raster, pixelsize) - modify pixelsize only and resample using the default method 
    413  
    414  2) ST_Resample(raster, method, pixelsize) - modify pixelsize and resample using the specified method 
    415  
    416  3) ST_Resample(raster, pixelsizex, pixelsizey) - modify pixelsize with different values for x and y using the default method 
    417  
    418  4) ST_Resample(raster, method, pixelsizex, pixelsizey) - modify pixelsize with different values for x and y using the specified method 
    419  
    420  * The '''second series of variants''' realign the raster and change the pixelsize 
    421  
    422  5) ST_Resample(raster, x, y, pixelsize) - realign and modify pixelsize using the default method 
    423  
    424  6) ST_Resample(raster, method, x, y, pixelsize) - realign and modify pixelsize using the specified method 
    425  
    426  7) ST_Resample(raster, x, y, pixelsizex, pixelsizey) - realign and modify pixelsize with different values for x and y using the default method 
    427  
    428  8) ST_Resample(raster, method, x, y, pixelsizex, pixelsizey) - realign and modify pixelsize with different values for x and y using the specified method 
    429  
    430  9) ST_Resample(raster, x, y, pixelsizex, pixelsizey, skewx, skewy) - realign and modify pixelsize and skew with different values for x and y using the default method 
    431  
    432  10) ST_Resample(raster, method, x, y, pixelsizex, pixelsizey, skewx, skewy) - realign and modify pixelsize and skew with different values for x and y using the specified method 
    433  
    434  * The '''third series of variants''' align and resample the raster to match the alignment, pixelsize and skew of an existing raster. 
    435   
    436  11) ST_Resample(destraster, sourceraster) 
    437  
    438  '''Questions''' 
    439  
    440  * Should there be a band parameter? 
    441  * How does GDAL allow resampling? 
    442  * Which methods GDAL supports? ArcGIS supports NEAREST | BILINEAR | CUBIC | MAJORITY 
    443  * Does GDAL support change in skew? 
     403'''ST_Resample(raster, method, originx, originy, pixelsizex, pixelsizey) -> raster - done see below''' 
    444404 
    445405'''ST_SelectByValue(raster, 'expression') -> same type as first argument''' 
     
    27462706ST_Transform enables the end-user to reproject a raster to a new projection.  Unlike the ST_Transform function for geometries, ST_Transform for rasters depends upon the specificiation of a resampling algorithm and an error tolerance.  In addition, reprojecting a raster will probably change the scale of the pixels.  Therefore, ST_Transform for rasters can be more involved than the ST_Transform for geometries. 
    27472707 
     2708''If a skewed raster is provided to ST_Transform, the output raster will be deskewed (zero skew in X and Y axes thus "north up").  To preserve the skew, use ST_Resample.'' 
     2709 
    274827101. ST_Transform(rast raster, srid integer, algorithm text DEFAULT '!NearestNeighbour', maxerr double precision DEFAULT 0.125, scalex double precision DEFAULT 0, scaley double precision DEFAULT 0) 
    27492711 
     
    32413203 
    32423204    nband is assumed to be 1. roundto is assumed to be 0, so no rounding takes place. exclude_nodata_value is assumed to be TRUE. 
     3205 
     3206---- 
     3207 
     3208'''ST_Resample(raster, method, originx, originy, pixelsizex, pixelsizey) -> raster''' 
     3209 
     3210ST_Resample is the main function underlying the ST_Transform, ST_Rescale, ST_Reskew and ST_SnapToGrid functions.  ST_Resample provides the ability to change a raster's projection, adjust the scale of the raster within its extent, change the skew (or deskew) and "dissolve" the raster to a grid. 
     3211 
     3212''If a skewed raster is provided to ST_Resample and skewx and/or skewy are not provided, the output raster will be deskewed (zero skew in X and Y axes thus "north up")'' 
     3213 
     32141. ST_Resample( 
     3215        rast raster, 
     3216        srid integer DEFAULT NULL, 
     3217        scalex double precision DEFAULT 0, scaley double precision DEFAULT 0, 
     3218        gridx double precision DEFAULT NULL, gridy double precision DEFAULT NULL, 
     3219        skewx double precision DEFAULT 0, skewy double precision DEFAULT 0, 
     3220        algorithm text DEFAULT 'NearestNeighbour', maxerr double precision DEFAULT 0.125 
     3221) -> raster 
     3222 
     3223  srid: the SRID that the function will use to reproject the raster to.  If NULL, the raster's SRID will be used. 
     3224 
     3225  scalex: the scale/pixel size in the X axis of the resampled raster.  If scalex and scaley are zero (0), the resampled raster's scale will be autocomputed.  If provided, scaley must also be provided. 
     3226 
     3227  scaley: the scale/pixel size in the Y axis of the resampled raster.  If scalex and scaley are zero (0), the resampled raster's scale will be autocomputed.  If provided, scalex must also be provided. 
     3228 
     3229  gridx: the X coordinate of a point on the grid to which the raster will be aligned.  Value is in the resampled raster's world coordinates.  If provided, gridy must also be provided. 
     3230 
     3231  gridy: the Y coordinate of a point on the grid to which the raster will be aligned.  Value is in the resampled raster's world coordinates.  If provided, gridx must also be provided. 
     3232 
     3233  skewx: the skew along the X axis of the resampled raster.  If skewx and skewy are zero (0), the resampled raster will be "north up". 
     3234 
     3235  skewy: the skew along the Y axis of the resampled raster.  If skewx and skewy are zero (0), the resampled raster will be "north up". 
     3236 
     3237  algorithm: the algorithm to use when resampling the raster. default is 'NearestNeighbour'. possible algorithms are: 
     3238 
     3239{{{ 
     3240NearestNeighbour (default.  fastest performance but worst interpolation) 
     3241 
     3242NearestNeighbor (for those wanting to use the American spelling) 
     3243 
     3244Bilinear 
     3245 
     3246Cubic 
     3247 
     3248CubicSpline 
     3249 
     3250Lanczos 
     3251}}} 
     3252 
     3253  maxerr: the threshold for 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.  
     3254 
     32552. ST_Resample( 
     3256        rast raster, 
     3257        ref raster, 
     3258        algorithm text DEFAULT 'NearestNeighbour', maxerr double precision DEFAULT 0.125 
     3259) -> raster 
     3260 
     3261  ref: the reference raster to which rast will copy the scalex, scaley, skewx, skewy and srid.  In addition, the upperleft corner of ref will be used as a grid point to align rast. 
     3262 
     3263---- 
     3264 
     3265'''ST_Rescale(raster, scalex, scaley) -> raster''' 
     3266 
     3267ST_Rescale is a focused function of ST_Resample for changing the X and Y scale without affecting the extent of the raster. 
     3268 
     3269''If a skewed raster is provided to ST_Rescale, the output raster will be deskewed (zero skew in X and Y axes thus "north up").  To preserve the skew, use ST_Resample.'' 
     3270 
     32711. ST_Rescale(rast raster, scalex double precision, scaley double precision, algorithm text DEFAULT 'NearestNeighbour', maxerr double precision DEFAULT 0.125) -> raster 
     3272 
     3273  scalex: the scale/pixel size in the X axis of the resampled raster 
     3274 
     3275  scaley: the scale/pixel size in the Y axis of the resampled raster 
     3276 
     32772. ST_Rescale(rast raster, scalexy double precision, algorithm text DEFAULT 'NearestNeighbour', maxerr double precision DEFAULT 0.125) -> raster 
     3278 
     3279  scalexy: the scale/pixel size in the X and Y axes of the resampled raster. 
     3280 
     3281---- 
     3282 
     3283'''ST_Reskew(raster, skewx, skewy) -> raster''' 
     3284 
     3285ST_Reskew is a focused function of ST_Resample for changing the skew along the X and Y axes. 
     3286 
     32871. ST_Reskew(rast raster, skewx double precision, skewy double precision, algorithm text DEFAULT 'NearestNeighbour', maxerr double precision DEFAULT 0.125) -> raster 
     3288 
     3289  skewx: the skew along the X axis of the resampled raster.  If skewx and skewy are zero (0), the resampled raster will be "north up". 
     3290 
     3291  skewy: the skew along the Y axis of the resampled raster.  If skewx and skewy are zero (0), the resampled raster will be "north up". 
     3292 
     32932. ST_Reskew(rast raster, skewxy double precision, algorithm text DEFAULT 'NearestNeighbour', maxerr double precision DEFAULT 0.125) -> raster 
     3294 
     3295  skewxy: the skew along both X and Y axes of the resampled raster.  If skewxy is zero (0), the resampled raster will be "north up". 
     3296 
     3297---- 
     3298 
     3299'''ST_SnapToGrid(raster, gridx, gridy)''' 
     3300 
     3301ST_SnapToGrid provides the ability to align a raster to grid (possibly that of a coverage).  The returned raster has its upper-left corner placed at the closest valid grid point to the source raster's upper-left corner without losing a data.  The same is done for the lower-right corner. 
     3302 
     3303''If a skewed raster is provided to ST_SnapToGrid, the output raster will be deskewed (zero skew in X and Y axes thus "north up").  To preserve the skew, use ST_Resample.'' 
     3304 
     33051. ST_SnapToGrid( 
     3306        rast raster, 
     3307        gridx double precision, gridy double precision, 
     3308        algorithm text DEFAULT 'NearestNeighbour', maxerr double precision DEFAULT 0.125, 
     3309        scalex double precision DEFAULT 0, scaley double precision DEFAULT 0 
     3310) -> raster 
     3311 
     3312  gridx: the X coordinate of a point on the grid to which the raster will be aligned.  Value is in the raster's world coordinates. 
     3313 
     3314  gridy: the Y coordinate of a point on the grid to which the raster will be aligned.  Value is in the raster's world coordinates. 
     3315 
     3316  scalex: the scale/pixel size in the X axis of the resampled raster.  This is also the scale of the grid to which the raster is being "snapped".  If provided, scaley must be provided.  If scalex and scaley are zero, the input raster's scale will be used. 
     3317 
     3318  scaley: the scale/pixel size in the Y axis of the resampled raster.  This is also the scale of the grid to which the raster is being "snapped"  If provided, scalex must be provided.  If scalex and scaley are zero, the input raster's scale will be used. 
     3319 
     33202. ST_SnapToGrid( 
     3321        rast raster, 
     3322        gridx double precision, gridy double precision, 
     3323        scalex double precision, scaley double precision, 
     3324        algorithm text DEFAULT 'NearestNeighbour', maxerr double precision DEFAULT 0.125 
     3325) -> raster 
     3326 
     33273. ST_SnapToGrid( 
     3328        rast raster, 
     3329        gridx double precision, gridy double precision, 
     3330        scalexy double precision, 
     3331        algorithm text DEFAULT 'NearestNeighbour', maxerr double precision DEFAULT 0.125 
     3332) -> raster 
     3333 
     3334  scalexy: the scale/pixel size in the X and Y axes of the resampled raster. 
     3335 
     3336~~ * Implemented as a wrapper around GDAL like done for ST_DumpAsPolygons()~~ 
     3337~~ * Resampling methods are the same as the one priovided by GDAL~~ 
     3338 
     3339~~ '''Variants'''~~ 
     3340 
     3341~~ * The '''first series of variants''' only change the pixelsize of the raster.~~ 
     3342 
     3343~~ 1) ST_Resample(raster, pixelsize) - modify pixelsize only and resample using the default method~~ 
     3344 
     3345~~ 2) ST_Resample(raster, method, pixelsize) - modify pixelsize and resample using the specified method~~ 
     3346 
     3347~~ 3) ST_Resample(raster, pixelsizex, pixelsizey) - modify pixelsize with different values for x and y using the default method~~ 
     3348 
     3349~~ 4) ST_Resample(raster, method, pixelsizex, pixelsizey) - modify pixelsize with different values for x and y using the specified method~~ 
     3350 
     3351~~ * The '''second series of variants''' realign the raster and change the pixelsize~~ 
     3352 
     3353~~ 5) ST_Resample(raster, x, y, pixelsize) - realign and modify pixelsize using the default method~~ 
     3354 
     3355~~ 6) ST_Resample(raster, method, x, y, pixelsize) - realign and modify pixelsize using the specified method~~ 
     3356 
     3357~~ 7) ST_Resample(raster, x, y, pixelsizex, pixelsizey) - realign and modify pixelsize with different values for x and y using the default method~~ 
     3358 
     3359~~ 8) ST_Resample(raster, method, x, y, pixelsizex, pixelsizey) - realign and modify pixelsize with different values for x and y using the specified method~~ 
     3360 
     3361~~ 9) ST_Resample(raster, x, y, pixelsizex, pixelsizey, skewx, skewy) - realign and modify pixelsize and skew with different values for x and y using the default method~~ 
     3362 
     3363~~ 10) ST_Resample(raster, method, x, y, pixelsizex, pixelsizey, skewx, skewy) - realign and modify pixelsize and skew with different values for x and y using the specified method~~ 
     3364 
     3365~~ * The '''third series of variants''' align and resample the raster to match the alignment, pixelsize and skew of an existing raster.~~ 
     3366  
     3367~~ 11) ST_Resample(destraster, sourceraster)~~ 
     3368 
     3369~~ '''Questions'''~~ 
     3370 
     3371~~ * Should there be a band parameter?~~ 
     3372 
     3373~~ * How does GDAL allow resampling?~~ 
     3374 
     3375~~ * Which methods GDAL supports? ArcGIS supports NEAREST | BILINEAR | CUBIC | MAJORITY~~ 
     3376 
     3377~~ * Does GDAL support change in skew?~~ 
     3378