From 491f2599cb48b6aee83bcd5b74bae7de607ef50e Mon Sep 17 00:00:00 2001 From: Pierre Racine Date: Fri, 2 Mar 2012 20:14:49 +0000 Subject: [PATCH] Fix for ticket #1589. Removed misleading example. git-svn-id: http://svn.osgeo.org/postgis/trunk@9387 b70326c6-7e19-0410-871a-916f4a2858ee --- doc/reference_raster.xml | 63 +++++++--------------------------------- 1 file changed, 11 insertions(+), 52 deletions(-) diff --git a/doc/reference_raster.xml b/doc/reference_raster.xml index 3f0ecf634..69468e52d 100644 --- a/doc/reference_raster.xml +++ b/doc/reference_raster.xml @@ -3706,60 +3706,19 @@ WHERE rid = 2; 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)) - +SELECT ST_PixelWidth(ST_AddBand(ST_MakeEmptyRaster(100, 100, 0, 0, 0.001, -0.001, 0, 0, 4269), '8BUI'::text, 1, 0)) width + + width +---------- +0.001 + -- 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 - FROM katrina; - - orig_scalex | origi_scaley ---------------------+--------------------- - 0.0293255131964809 | -0.0293255131964809 - - --I create a table of 2 rasters one 25% of original and one 75% of original - CREATE TABLE katrinas_rescaled(rid serial primary key, descrip text, rast raster); +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)) width - INSERT INTO katrinas_rescaled(descrip, rast) - SELECT 'rescaled ' || round((1.0/i*100), 2)::text || '%', ST_Rescale(rast, ST_ScaleX(rast)*i, ST_ScaleY(rast)*i) - FROM katrina CROSS JOIN generate_series(6, 8, 2) As i; - -SELECT descrip, ST_ScaleX(rast) As newsx, ST_ScaleY(rast) As newsy - FROM katrinas_rescaled; - - descrip | newsx | newsy -----------------+-------------------+-------------------- - rescaled 16.67% | 0.175953079178886 | -0.175953079178886 - rescaled 12.50% | 0.234604105571848 | -0.234604105571848 - - - - - - - - - - - at 16.67% size of original - - - - - - - - at 12.50% size of original - - - - - - + width +---------- +0.0015 + -- 2.40.0