From 314b8bd5ee1645ee2682f4e093ed0b377c6de0e1 Mon Sep 17 00:00:00 2001 From: Pierre Racine Date: Fri, 17 Feb 2012 22:23:19 +0000 Subject: [PATCH] Rewrote the ST_Rescale documentation. git-svn-id: http://svn.osgeo.org/postgis/trunk@9232 b70326c6-7e19-0410-871a-916f4a2858ee --- doc/reference_raster.xml | 43 ++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/doc/reference_raster.xml b/doc/reference_raster.xml index 9d3813353..cf9ecd83a 100644 --- a/doc/reference_raster.xml +++ b/doc/reference_raster.xml @@ -3249,6 +3249,9 @@ FROM ( Sets the X and Y size of pixels in units of coordinate reference system. Number units/pixel width/height. If only one unit passed in, assumed X and Y are the same number. + + ST_SetScale is different from in that ST_SetScale do not resample the raster to match the raster extent. It only changes the metadata (or georeference) of the raster to correct an originally mis-specified scaling. ST_Rescale results in a raster having different width and height computed to fit the geographic extent of the input raster. ST_SetScale do not modify the width, nor the height of the raster. + Changed: 2.0.0 In WKTRaster versions this was called ST_SetPixelSize. This was changed in 2.0.0. @@ -3565,9 +3568,8 @@ WHERE rid = 2; ST_Rescale - Rescales a raster that is in a known spatial ref and using specified algorithm. - Uses NearestNeighbor if no algorithm is specified Options: NearestNeighbor (english or american spelling), Bilinear, Cubic, CubicSpline, Lanczos. - the scalex, scaley, scalexy are the desired new ratio between pixel coordinates and geometry coordinates. + Resample a raster by adjusting only its scale (or pixel size). New pixel values are computed using the NearestNeighbor (english or american spelling), Bilinear, Cubic, CubicSpline or Lanczos algorithm. The default is NearestNeighbor. + @@ -3595,18 +3597,30 @@ WHERE rid = 2; Description - Rescales a raster using specified pixel warping algorithm. - Uses 'NearestNeighbor' if no algorithm is specified and maxerror percent of 0.125 if no maxerr is specified. - Algorithm options are: 'NearestNeighbor', 'Bilinear', 'Cubic', 'CubicSpline', and 'Lanczos'. Refer to: GDAL Warp resampling methods for more details. NearestNeighbor is the fastest but worst interpolation. - The scalex, scaley define the desired new ratio between geometry units and pixel units. - Note: This is different from in that ST_Rescale changes the underlying pixels of the raster using existing scale - and rescales it to the new input scales. , on the other hand, changes the metadata of the raster to correct an originally mis-specified scaling. + Resample a raster by adjusting only its scale (or pixel size). New pixel values are computed using the NearestNeighbor (english or american spelling), Bilinear, Cubic, CubicSpline or Lanczos algorithm. The default is NearestNeighbor which is the fastest but results in the worst interpolation. + + scalex and scaley define the new pixel size. scaley must often be negative to get well oriented raster. When the new scalex is not a divisor of the raster width, the horizontal extent of the resulting raster is adjusted. The same rule applies to the vertical extent when the new scaley is not a divisor of the height of the raster. + + A maxerror percent of 0.125 if no maxerr is specified. + + Refer to: GDAL Warp resampling methods for more details. + + ST_Rescale is different from in that ST_SetScale do not resample the raster to match the raster extent. ST_SetScale only changes the metadata (or georeference) of the raster to correct an originally mis-specified scaling. ST_Rescale results in a raster having different width and height computed to fit the geographic extent of the input raster. ST_SetScale do not modify the width, nor the height of the raster. + Availability: 2.0.0 Requires GDAL 1.6.1+ Examples - Examples utilize the katrina raster loaded as a single tile described in + A simple example rescaling a raster from a pixel size of 0.001 degree to a pixel size of 0.0015 degree. + + -- the original raster pixel size + SELECT ST_PixelWidth(ST_AddBand(ST_MakeEmptyRaster(100, 100, 0, 0, 0.001, -0.001, 0, 0, 4269), '8BUI'::text, 1, 0)) + + -- the rescaled raster raster pixel size + SELECT ST_PixelWidth(ST_Rescale(ST_AddBand(ST_MakeEmptyRaster(100, 100, 0, 0, 0.001, -0.001, 0, 0, 4269), '8BUI'::text, 1, 0), 0.0015)) + + This example utilize the katrina raster loaded as a single tile described in http://trac.osgeo.org/gdal/wiki/frmts_wtkraster.html -- My original raster that is in WGS 84 lon lat 1 pixel in x/y represents 0.029.. in long lat - SELECT ST_ScaleX(rast) As orig_scalex, ST_ScaleY(rast) As origi_scaley @@ -3666,8 +3680,7 @@ SELECT descrip, ST_ScaleX(rast) As newsx, ST_ScaleY(rast) As newsy ST_Transform - Reprojects a raster in a known spatial reference system to another known spatial reference system using specified resampling algorithm. - Uses NearestNeighbor if no algorithm is specified Options: NearestNeighbor, Bilinear, Cubic, CubicSpline, Lanczos. + Reprojects a raster in a known spatial reference system to another known spatial reference system using specified resampling algorithm. Options are NearestNeighbor, Bilinear, Cubic, CubicSpline, Lanczos defaulting to NearestNeighbor. @@ -5623,11 +5636,11 @@ FROM dummy_rast; In all variants, if no band number is specified band 1 is assumed. - To get more control on the resulting extent or on what to return when encountering a nodata value, use the two rasters version of . + To get more control on the resulting extent or on what to return when encountering a nodata value, use the two rasters version of . - The variants returning a raster and taking a geometry are very similar to ST_Clip with the exception that ST_Clip() works on multiple band rasters and never returns a band corresponding to the rasterized geometry. ST_Intersection(raster, geometry) works only on one band and may return a band corresponding to the rasterized geometry (when 'BOTH' or 'SECOND' are passed as the returnband parameter). + The variants returning a raster and taking a geometry are very similar to ST_Clip with the exception that ST_Clip() works on multiple band rasters and never returns a band corresponding to the rasterized geometry. ST_Intersection(raster, geometry) works only on one band and may return a band corresponding to the rasterized geometry (when 'BOTH' or 'SECOND' are passed as the returnband parameter). - ST_Intersection() Should be used in conjunction with ST_Intersects and an index on the raster column or the geometry column. + ST_Intersection() Should be used in conjunction with ST_Intersects and an index on the raster column or the geometry column. Enhanced: 2.0.0 - Intersection in the raster world was introduced. In earlier pre-2.0.0 versions, only intersection performed in vector world were supported. -- 2.40.0