From: Bborie Park Date: Thu, 29 Nov 2012 18:59:22 +0000 (+0000) Subject: Removed confusion between ST_Resample(raster) and ST_Transform(raster) X-Git-Tag: 2.1.0beta2~345 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e11c36ae9ef3ba6582a1be2c7e7a851037bcdeab;p=postgis Removed confusion between ST_Resample(raster) and ST_Transform(raster) by removing srid parameter for ST_Resample(). Ticket #1653 git-svn-id: http://svn.osgeo.org/postgis/trunk@10760 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/NEWS b/NEWS index 06798ab9b..ca8d50454 100644 --- a/NEWS +++ b/NEWS @@ -10,7 +10,8 @@ PostGIS 2.1.0 of input geometry and raster. - ST_Hillshade parameters azimuth and altitude are now in degrees instead of radians. - - ST_Slope and ST_Aspect return pixel values in degrees instead of radians + - ST_Slope and ST_Aspect return pixel values in degrees instead of radians. + - #1653, Removed srid parameter from ST_Resample(raster). * Deprecated signatures diff --git a/doc/reference_raster.xml b/doc/reference_raster.xml index 7b44b2d2e..142e6b15e 100644 --- a/doc/reference_raster.xml +++ b/doc/reference_raster.xml @@ -5430,7 +5430,7 @@ WHERE rid = 2; ST_Resample - Resample a raster using a specified resampling algorithm, new dimensions, an arbitrary grid corner and a set of raster georeferencing attributes defined or borrowed from another raster. New pixel values are computed using the NearestNeighbor (english or american spelling), Bilinear, Cubic, CubicSpline or Lanczos resampling algorithm. Default is NearestNeighbor. + Resample a raster using a specified resampling algorithm, new dimensions, an arbitrary grid corner and a set of raster georeferencing attributes defined or borrowed from another raster. New pixel values are computed using the NearestNeighbor (English or American spelling), Bilinear, Cubic, CubicSpline or Lanczos resampling algorithm. Default is NearestNeighbor. @@ -5440,7 +5440,6 @@ WHERE rid = 2; raster rast integer width integer height - integer srid=same_as_rast double precision gridx=NULL double precision gridy=NULL double precision skewx=0 @@ -5452,7 +5451,6 @@ WHERE rid = 2; raster ST_Resample raster rast - integer srid=NULL double precision scalex=0 double precision scaley=0 double precision gridx=NULL @@ -5488,30 +5486,39 @@ WHERE rid = 2; Resample a raster using a specified resampling algorithm, new dimensions (width & height), a grid corner (gridx & gridy) and a set of raster georeferencing attributes (scalex, scaley, skewx & skewy) defined or borrowed from another raster. - New pixel values are computed using the NearestNeighbor (english or american spelling), Bilinear, Cubic, CubicSpline or Lanczos resampling algorithm. Default is NearestNeighbor which is the fastest but produce the worst interpolation. + New pixel values are computed using the NearestNeighbor (English or American spelling), Bilinear, Cubic, CubicSpline or Lanczos resampling algorithm. Default is NearestNeighbor which is the fastest but produce the worst interpolation. A maxerror percent of 0.125 is used if no maxerr is specified. Only works if raster is in a known spatial reference system (SRID). Refer to: GDAL Warp resampling methods for more details. - Availability: 2.0.0 Requires GDAL 1.6.1+ + Availability: 2.0.0 Requires GDAL 1.6.1+ + Changed: 2.1.0 Parameter srid removed. Use ST_Transform() to reproject raster - Examples + Examples - SELECT ST_Width(orig) As orig_width, ST_Width(reduce_100) As new_width - FROM ( - SELECT rast As orig, ST_Resample(rast,100,100) As reduce_100 - FROM aerials.boston + +SELECT + ST_Width(orig) AS orig_width, + ST_Width(reduce_100) AS new_width +FROM ( + SELECT + rast AS orig, + ST_Resample(rast,100,100) AS reduce_100 + FROM aerials.boston WHERE ST_Intersects(rast, - ST_Transform( - ST_MakeEnvelope(-71.128, 42.2392,-71.1277, 42.2397, 4326),26986) ) - limit 1 ) As foo; + ST_Transform( + ST_MakeEnvelope(-71.128, 42.2392,-71.1277, 42.2397, 4326),26986) + ) + LIMIT 1 +) AS foo; + orig_width | new_width ------------+------------- 200 | 100 - + diff --git a/raster/rt_pg/rtpostgis.sql.in.c b/raster/rt_pg/rtpostgis.sql.in.c index c872d1c35..3eb8580ad 100644 --- a/raster/rt_pg/rtpostgis.sql.in.c +++ b/raster/rt_pg/rtpostgis.sql.in.c @@ -1995,26 +1995,24 @@ CREATE OR REPLACE FUNCTION _st_gdalwarp( CREATE OR REPLACE FUNCTION st_resample( rast raster, - srid integer DEFAULT NULL, scalex double precision DEFAULT 0, scaley double precision DEFAULT 0, gridx double precision DEFAULT NULL, gridy double precision DEFAULT NULL, skewx double precision DEFAULT 0, skewy double precision DEFAULT 0, algorithm text DEFAULT 'NearestNeighbour', maxerr double precision DEFAULT 0.125 ) RETURNS raster - AS $$ SELECT _st_gdalwarp($1, $9, $10, $2, $3, $4, $5, $6, $7, $8) $$ + AS $$ SELECT _st_gdalwarp($1, $8, $9, NULL, $2, $3, $4, $5, $6, $7) $$ LANGUAGE 'sql' STABLE; CREATE OR REPLACE FUNCTION st_resample( rast raster, width integer, height integer, - srid integer DEFAULT NULL, gridx double precision DEFAULT NULL, gridy double precision DEFAULT NULL, skewx double precision DEFAULT 0, skewy double precision DEFAULT 0, algorithm text DEFAULT 'NearestNeighbour', maxerr double precision DEFAULT 0.125 ) RETURNS raster - AS $$ SELECT _st_gdalwarp($1, $9, $10, $4, NULL, NULL, $5, $6, $7, $8, $2, $3) $$ + AS $$ SELECT _st_gdalwarp($1, $8, $9, NULL, NULL, NULL, $4, $5, $6, $7, $2, $3) $$ LANGUAGE 'sql' STABLE; CREATE OR REPLACE FUNCTION st_resample( @@ -2027,7 +2025,6 @@ CREATE OR REPLACE FUNCTION st_resample( RETURNS raster AS $$ DECLARE - sr_id int; dim_x int; dim_y int; scale_x double precision; @@ -2037,7 +2034,7 @@ CREATE OR REPLACE FUNCTION st_resample( skew_x double precision; skew_y double precision; BEGIN - SELECT srid, width, height, scalex, scaley, upperleftx, upperlefty, skewx, skewy INTO sr_id, dim_x, dim_y, scale_x, scale_y, grid_x, grid_y, skew_x, skew_y FROM st_metadata($2); + SELECT width, height, scalex, scaley, upperleftx, upperlefty, skewx, skewy INTO dim_x, dim_y, scale_x, scale_y, grid_x, grid_y, skew_x, skew_y FROM st_metadata($2); IF usescale IS TRUE THEN dim_x := NULL; @@ -2047,7 +2044,7 @@ CREATE OR REPLACE FUNCTION st_resample( scale_y := NULL; END IF; - RETURN _st_gdalwarp($1, $3, $4, sr_id, scale_x, scale_y, grid_x, grid_y, skew_x, skew_y, dim_x, dim_y); + RETURN _st_gdalwarp($1, $3, $4, NULL, scale_x, scale_y, grid_x, grid_y, skew_x, skew_y, dim_x, dim_y); END; $$ LANGUAGE 'plpgsql' STABLE STRICT; @@ -2086,8 +2083,21 @@ CREATE OR REPLACE FUNCTION st_transform( algorithm text DEFAULT 'NearestNeighbour', maxerr double precision DEFAULT 0.125 ) RETURNS raster - AS $$ SELECT st_resample($1, $2, $3, $4, TRUE) $$ - LANGUAGE 'sql' STABLE STRICT; + AS $$ + DECLARE + _srid integer; + _scalex double precision; + _scaley double precision; + _gridx double precision; + _gridy double precision; + _skewx double precision; + _skewy double precision; + BEGIN + SELECT srid, scalex, scaley, upperleftx, upperlefty, skewx, skewy INTO _srid, _scalex, _scaley, _gridx, _gridy, _skewx, _skewy FROM st_metadata($2); + + RETURN _st_gdalwarp($1, $3, $4, _srid, _scalex, _scaley, _gridx, _gridy, _skewx, _skewy, NULL, NULL); + END; + $$ LANGUAGE 'plpgsql' STABLE STRICT; ----------------------------------------------------------------------- -- ST_Rescale diff --git a/raster/rt_pg/rtpostgis_drop.sql.in.c b/raster/rt_pg/rtpostgis_drop.sql.in.c index ec2e2f724..ac3d13012 100644 --- a/raster/rt_pg/rtpostgis_drop.sql.in.c +++ b/raster/rt_pg/rtpostgis_drop.sql.in.c @@ -470,3 +470,7 @@ DROP FUNCTION IF EXISTS st_raster2worldcoordy(raster, int); -- function name change DROP FUNCTION IF EXISTS _st_resample(raster, text, double precision, integer, double precision, double precision, double precision, double precision, double precision, double precision, integer, integer); + +-- function signatures changed +DROP FUNCTION IF EXISTS st_resample(raster, integer, double precision, double precision, double precision, double precision, double precision, double precision, text, double precision); +DROP FUNCTION IF EXISTS st_resample(raster, integer, integer, integer, double precision, double precision, double precision, double precision, text, double precision); diff --git a/raster/test/regress/Makefile.in b/raster/test/regress/Makefile.in index 0fec54de3..f476d4da9 100644 --- a/raster/test/regress/Makefile.in +++ b/raster/test/regress/Makefile.in @@ -87,7 +87,7 @@ TEST_UTILITY = \ rt_asjpeg \ rt_aspng \ rt_reclass \ - rt_resample \ + rt_gdalwarp \ rt_asraster \ rt_dumpvalues diff --git a/raster/test/regress/rt_resample.sql b/raster/test/regress/rt_gdalwarp.sql similarity index 67% rename from raster/test/regress/rt_resample.sql rename to raster/test/regress/rt_gdalwarp.sql index 4322cd68d..a05f4a740 100644 --- a/raster/test/regress/rt_resample.sql +++ b/raster/test/regress/rt_gdalwarp.sql @@ -1,9 +1,9 @@ -DROP TABLE IF EXISTS raster_resample_src; -DROP TABLE IF EXISTS raster_resample_dst; -CREATE TABLE raster_resample_src ( +DROP TABLE IF EXISTS raster_gdalwarp_src; +DROP TABLE IF EXISTS raster_gdalwarp_dst; +CREATE TABLE raster_gdalwarp_src ( rast raster ); -CREATE TABLE raster_resample_dst ( +CREATE TABLE raster_gdalwarp_dst ( rid varchar, rast raster ); @@ -27,7 +27,7 @@ CREATE OR REPLACE FUNCTION make_test_raster() END LOOP; END LOOP; - INSERT INTO raster_resample_src VALUES (rast); + INSERT INTO raster_gdalwarp_src VALUES (rast); RETURN; END; @@ -50,520 +50,664 @@ INSERT INTO "spatial_ref_sys" ("srid","auth_name","auth_srid","srtext","proj4tex INSERT INTO "spatial_ref_sys" ("srid","auth_name","srtext","proj4text") VALUES (984269,'EPSG','GEOGCS["NAD83",DATUM["North_American_Datum_1983",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],AUTHORITY["EPSG","6269"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4269"]]','+proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs '); INSERT INTO "spatial_ref_sys" ("srid","srtext") VALUES (974269,'GEOGCS["NAD83",DATUM["North_American_Datum_1983",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],AUTHORITY["EPSG","6269"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4269"]]'); --- ST_Resample -INSERT INTO raster_resample_dst (rid, rast) VALUES ( - 1.0, (SELECT ST_Resample( +-- _st_gdalwarp +INSERT INTO raster_gdalwarp_dst (rid, rast) VALUES ( + 0.0, (SELECT _st_gdalwarp( NULL )) ), ( - 1.1, (SELECT ST_Resample( - rast - ) FROM raster_resample_src) -), ( - 1.2, (SELECT ST_Resample( + 0.1, (SELECT _st_gdalwarp( rast, + 'NearestNeighbour', 0.125, 993310 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( - 1.3, (SELECT ST_Resample( + 0.2, (SELECT _st_gdalwarp( rast, + 'NearestNeighbour', 0.125, 993309 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( - 1.4, (SELECT ST_Resample( + 0.3, (SELECT _st_gdalwarp( rast, + 'NearestNeighbour', 0.125, 994269 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( - 1.5, (SELECT ST_Resample( + 0.4, (SELECT _st_gdalwarp( rast, + 'NearestNeighbor', 0.125, 993310, 500., 500., NULL, NULL, - 0, 0, - 'NearestNeighbor', 0.125 - ) FROM raster_resample_src) + 0, 0 + ) FROM raster_gdalwarp_src) ), ( - 1.6, (SELECT ST_Resample( + 0.5, (SELECT _st_gdalwarp( rast, + 'NearestNeighbor', 0.125, NULL, 100., NULL - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( - 1.7, (SELECT ST_Resample( + 0.6, (SELECT _st_gdalwarp( rast, + 'NearestNeighbor', 0.125, NULL, NULL::double precision, 100. - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( - 1.8, (SELECT ST_Resample( + 0.7, (SELECT _st_gdalwarp( rast, + 'NearestNeighbor', 0.125, NULL, 500., 500. - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( - 1.9, (SELECT ST_Resample( + 0.8, (SELECT _st_gdalwarp( rast, + 'NearestNeighbor', 0.125, NULL, 250., 250., NULL, NULL, NULL, NULL - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( - 1.10, (SELECT ST_Resample( + 0.9, (SELECT _st_gdalwarp( rast, + 'Bilinear', 0, NULL, 250., 250., NULL, NULL, - NULL, NULL, - 'Bilinear', 0 - ) FROM raster_resample_src) + NULL, NULL + ) FROM raster_gdalwarp_src) ), ( - 1.11, (SELECT ST_Resample( + 0.10, (SELECT _st_gdalwarp( rast, + 'NearestNeighbor', 0.125, NULL, NULL, NULL, -500000, 600000 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( - 1.12, (SELECT ST_Resample( + 0.11, (SELECT _st_gdalwarp( rast, + 'NearestNeighbor', 0.125, NULL, NULL, NULL, -500001, 600000 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( - 1.13, (SELECT ST_Resample( + 0.12, (SELECT _st_gdalwarp( rast, + 'NearestNeighbor', 0.125, NULL, NULL, NULL, -500000, 600009 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( - 1.14, (SELECT ST_Resample( + 0.13, (SELECT _st_gdalwarp( rast, + 'NearestNeighbor', 0.125, NULL, NULL, NULL, -500100, 599950 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( - 1.15, (SELECT ST_Resample( + 0.14, (SELECT _st_gdalwarp( rast, + 'NearestNeighbor', 0.125, NULL, 50., 50., -290, 7 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( - 1.16, (SELECT ST_Resample( + 0.15, (SELECT _st_gdalwarp( rast, + 'NearestNeighbor', 0.125, NULL, 121., 121., 0, 0 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( - 1.17, (SELECT ST_Resample( + 0.16, (SELECT _st_gdalwarp( rast, + 'NearestNeighbor', 0.125, 993310, 50., 50., -290, 7 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( - 1.18, (SELECT ST_Resample( + 0.17, (SELECT _st_gdalwarp( rast, + 'NearestNeighbor', 0.125, 993309, 50., 50., -290, 7 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( - 1.19, (SELECT ST_Resample( + 0.18, (SELECT _st_gdalwarp( rast, + 'NearestNeighbor', 0.125, NULL, NULL, NULL, NULL, NULL, 3, 3 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( - 1.20, (SELECT ST_Resample( - rast, - 993310, - NULL, NULL, - NULL, NULL, - 3, 3, - 'Cubic', 0 - ) FROM raster_resample_src) + 0.19, (SELECT _st_gdalwarp( + rast, + 'Cubic', 0, + 993310, + NULL, NULL, + NULL, NULL, + 3, 3 + ) FROM raster_gdalwarp_src) ), ( - 1.21, (SELECT ST_Resample( + 0.20, (SELECT _st_gdalwarp( rast, + 'Bilinear', 0.125, 993309, NULL, NULL, NULL, NULL, + 1, 3 + ) FROM raster_gdalwarp_src) +), ( + 0.21, (SELECT _st_gdalwarp( + rast, + 'Cubic', 0, + 993310, + 500., 500., + NULL, NULL, + 3, 3 + ) FROM raster_gdalwarp_src) +), ( + 0.22, (SELECT _st_gdalwarp( + rast, + 'CubicSpline', 0.125, + 993310, + 500., 500., + -12048, 14682, + 0, 6 + ) FROM raster_gdalwarp_src) +), ( + 0.23, (SELECT _st_gdalwarp( + rast, + 'NearestNeighbor', 0.125, + 984269 + ) FROM raster_gdalwarp_src) +), ( + 0.24, (SELECT _st_gdalwarp( + rast, + 'NearestNeighbor', 0.125, + 974269 + ) FROM raster_gdalwarp_src) +); + +-- ST_Resample +INSERT INTO raster_gdalwarp_dst (rid, rast) VALUES ( + 1.0, (SELECT ST_Resample( + NULL + )) +), ( + 1.1, (SELECT ST_Resample( + rast + ) FROM raster_gdalwarp_src) +), ( + 1.2, (SELECT ST_Resample( + rast, + 500., 500., + NULL, NULL, + 0, 0, + 'NearestNeighbor', 0.125 + ) FROM raster_gdalwarp_src) +), ( + 1.3, (SELECT ST_Resample( + rast, + 100., NULL + ) FROM raster_gdalwarp_src) +), ( + 1.4, (SELECT ST_Resample( + rast, + NULL::double precision, 100. + ) FROM raster_gdalwarp_src) +), ( + 1.5, (SELECT ST_Resample( + rast, + 500., 500. + ) FROM raster_gdalwarp_src) +), ( + 1.6, (SELECT ST_Resample( + rast, + 250., 250., + NULL, NULL, + NULL, NULL + ) FROM raster_gdalwarp_src) +), ( + 1.7, (SELECT ST_Resample( + rast, + 250., 250., + NULL, NULL, + NULL, NULL, + 'Bilinear', 0 + ) FROM raster_gdalwarp_src) +), ( + 1.8, (SELECT ST_Resample( + rast, + NULL::double precision, NULL::double precision, + -500000, 600000 + ) FROM raster_gdalwarp_src) +), ( + 1.9, (SELECT ST_Resample( + rast, + NULL::double precision, NULL::double precision, + -500001, 600000 + ) FROM raster_gdalwarp_src) +), ( + 1.10, (SELECT ST_Resample( + rast, + NULL::double precision, NULL::double precision, + -500000, 600009 + ) FROM raster_gdalwarp_src) +), ( + 1.11, (SELECT ST_Resample( + rast, + NULL::double precision, NULL::double precision, + -500100, 599950 + ) FROM raster_gdalwarp_src) +), ( + 1.12, (SELECT ST_Resample( + rast, + 50., 50., + -290, 7 + ) FROM raster_gdalwarp_src) +), ( + 1.13, (SELECT ST_Resample( + rast, + 121., 121., + 0, 0 + ) FROM raster_gdalwarp_src) +), ( + 1.14, (SELECT ST_Resample( + rast, + 50., 50., + -290, 7 + ) FROM raster_gdalwarp_src) +), ( + 1.15, (SELECT ST_Resample( + rast, + 50., 50., + -290, 7 + ) FROM raster_gdalwarp_src) +), ( + 1.16, (SELECT ST_Resample( + rast, + NULL::double precision, NULL, + NULL, NULL, + 3, 3 + ) FROM raster_gdalwarp_src) +), ( + 1.17, (SELECT ST_Resample( + rast, + NULL::double precision, NULL, + NULL, NULL, + 3, 3, + 'Cubic', 0 + ) FROM raster_gdalwarp_src) +), ( + 1.18, (SELECT ST_Resample( + rast, + NULL::double precision, NULL, + NULL, NULL, 1, 3, 'Bilinear' - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( - 1.22, (SELECT ST_Resample( + 1.19, (SELECT ST_Resample( rast, - 993310, 500., 500., NULL, NULL, 3, 3, 'Cubic', 0 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( - 1.23, (SELECT ST_Resample( + 1.20, (SELECT ST_Resample( rast, - 993310, 500., 500., -12048, 14682, 0, 6, 'CubicSpline' - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( - 1.24, (SELECT ST_Resample( + 1.21, (SELECT ST_Resample( rast, ST_MakeEmptyRaster(5, 5, -654321, 123456, 50, -100, 3, 0, 992163) - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( - 1.25, (SELECT ST_Resample( + 1.22, (SELECT ST_Resample( rast, ST_MakeEmptyRaster(5, 5, -654321, 123456, 50, -100, 3, 0, 992163), TRUE - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( - 1.26, (SELECT ST_Resample( + 1.23, (SELECT ST_Resample( rast, - 150, 150 - ) FROM raster_resample_src) + 150::int, 150::int + ) FROM raster_gdalwarp_src) ), ( - 1.27, (SELECT ST_Resample( - rast, - 150, 150, - 993310 - ) FROM raster_resample_src) -), ( - 1.28, (SELECT ST_Resample( + 1.24, (SELECT ST_Resample( rast, ST_MakeEmptyRaster(5, 5, -654321, 123456, 100, 100, 0, 0, 992163), FALSE - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( - 1.29, (SELECT ST_Resample( + 1.25, (SELECT ST_Resample( rast, NULL::raster, FALSE - ) FROM raster_resample_src) -), ( - 1.30, (SELECT ST_Resample( - rast, - 984269 - ) FROM raster_resample_src) -), ( - 1.31, (SELECT ST_Resample( - rast, - 974269 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ); -- ST_Transform -INSERT INTO raster_resample_dst (rid, rast) VALUES ( +INSERT INTO raster_gdalwarp_dst (rid, rast) VALUES ( 2.1, (SELECT ST_Transform( rast, 993310 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 2.2, (SELECT ST_Transform( rast, 993309 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 2.3, (SELECT ST_Transform( rast, 994269 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 2.4, (SELECT ST_Transform( rast, 993310, NULL - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 2.5, (SELECT ST_Transform( rast, 993310, 'Bilinear' - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 2.6, (SELECT ST_Transform( rast, 993310, 'Bilinear', NULL::double precision - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 2.7, (SELECT ST_Transform( rast, 993310, 'Cubic', 0.0 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 2.8, (SELECT ST_Transform( rast, 993310, 'NearestNeighbour', 0.0 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 2.9, (SELECT ST_Transform( rast, 993310, 'NearestNeighbor', 0.0 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 2.10, (SELECT ST_Transform( rast, 993310, 'NearestNeighbor', 0.125, 500, 500 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 2.11, (SELECT ST_Transform( rast, 993309, 'Cubic', 0., 100, 100 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 2.12, (SELECT ST_Transform( rast, 993310, 'CubicSpline', 0., 2000, 2000 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 2.13, (SELECT ST_Transform( rast, 993310, 'CubicSpline', 0.1, 1500, 1500 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 2.14, (SELECT ST_Transform( rast, 993310, 500, 500 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 2.15, (SELECT ST_Transform( rast, 993310, 750 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ); -- ST_Rescale -INSERT INTO raster_resample_dst (rid, rast) VALUES ( +INSERT INTO raster_gdalwarp_dst (rid, rast) VALUES ( 3.1, (SELECT ST_Rescale( rast, 100, 100 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 3.2, (SELECT ST_Rescale( rast, 100 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 3.3, (SELECT ST_Rescale( rast, 0, 0 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 3.4, (SELECT ST_Rescale( rast, 0 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 3.5, (SELECT ST_Rescale( rast, 100, 100, 'Bilinear', 0 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 3.6, (SELECT ST_Rescale( rast, 150, 125, 'Cubic' - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ); -- ST_Reskew -INSERT INTO raster_resample_dst (rid, rast) VALUES ( +INSERT INTO raster_gdalwarp_dst (rid, rast) VALUES ( 4.1, (SELECT ST_Reskew( rast, 0, 0 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 4.2, (SELECT ST_Reskew( rast, 1, 1 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 4.3, (SELECT ST_Reskew( rast, 0.5, 0 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 4.4, (SELECT ST_Reskew( rast, 10 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 4.5, (SELECT ST_Reskew( rast, 10, 'CubicSpline' - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 4.6, (SELECT ST_Reskew( rast, 10, 'Bilinear', 0 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ); -- ST_SnapToGrid -INSERT INTO raster_resample_dst (rid, rast) VALUES ( +INSERT INTO raster_gdalwarp_dst (rid, rast) VALUES ( 5.1, (SELECT ST_SnapToGrid( rast, -500000, 600000 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 5.2, (SELECT ST_SnapToGrid( rast, 0, 0 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 5.3, (SELECT ST_SnapToGrid( rast, -1, 600000 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 5.4, (SELECT ST_SnapToGrid( rast, -500001, 600000 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 5.5, (SELECT ST_SnapToGrid( rast, 1, 600000 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 5.6, (SELECT ST_SnapToGrid( rast, -500000, -1 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 5.7, (SELECT ST_SnapToGrid( rast, -500000, -9 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 5.8, (SELECT ST_SnapToGrid( rast, -500000, 1 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 5.9, (SELECT ST_SnapToGrid( rast, -500000, 9 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 5.10, (SELECT ST_SnapToGrid( rast, -5, 1 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 5.11, (SELECT ST_SnapToGrid( rast, 9, -9 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 5.12, (SELECT ST_SnapToGrid( rast, -500000, 600000, 50, 50 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 5.13, (SELECT ST_SnapToGrid( rast, 0, 0, 50, 50 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 5.14, (SELECT ST_SnapToGrid( rast, -1, 600000, 50, 50 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 5.15, (SELECT ST_SnapToGrid( rast, -500001, 600000, 50, 50 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 5.16, (SELECT ST_SnapToGrid( rast, 1, 600000, 50, 50 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 5.17, (SELECT ST_SnapToGrid( rast, -500000, -1, 50, 50 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 5.18, (SELECT ST_SnapToGrid( rast, -500000, -9, 50, 50 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 5.19, (SELECT ST_SnapToGrid( rast, -500000, 1, 50, 50 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 5.20, (SELECT ST_SnapToGrid( rast, -500000, 9, 50, 50 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 5.21, (SELECT ST_SnapToGrid( rast, -5, 1, 50, 50 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 5.22, (SELECT ST_SnapToGrid( rast, 9, -9, 50, 50 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 5.23, (SELECT ST_SnapToGrid( rast, 0, 0, 121 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 5.24, (SELECT ST_SnapToGrid( rast, -500000, 1, 121 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 5.25, (SELECT ST_SnapToGrid( rast, -500000, 9, 121 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 5.26, (SELECT ST_SnapToGrid( rast, -5, 1, 121 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ), ( 5.27, (SELECT ST_SnapToGrid( rast, 9, -9, 121 - ) FROM raster_resample_src) + ) FROM raster_gdalwarp_src) ); SELECT @@ -586,12 +730,12 @@ FROM ( rid, (ST_MetaData(rast)).*, (ST_SummaryStats(rast)).* - FROM raster_resample_dst + FROM raster_gdalwarp_dst ORDER BY rid ) foo; -DROP TABLE raster_resample_src; -DROP TABLE raster_resample_dst; +DROP TABLE raster_gdalwarp_src; +DROP TABLE raster_gdalwarp_dst; WITH foo AS ( SELECT 0 AS rid, ST_AddBand(ST_MakeEmptyRaster(2, 2, -500000, 600000, 100, -100, 0, 0, 992163), 1, '16BUI', 1, 0) AS rast UNION ALL @@ -631,4 +775,3 @@ DELETE FROM "spatial_ref_sys" WHERE srid = 993310; DELETE FROM "spatial_ref_sys" WHERE srid = 994269; DELETE FROM "spatial_ref_sys" WHERE srid = 984269; DELETE FROM "spatial_ref_sys" WHERE srid = 974269; - diff --git a/raster/test/regress/rt_resample_expected b/raster/test/regress/rt_gdalwarp_expected similarity index 60% rename from raster/test/regress/rt_resample_expected rename to raster/test/regress/rt_gdalwarp_expected index 85846654e..b468b0ef2 100644 --- a/raster/test/regress/rt_resample_expected +++ b/raster/test/regress/rt_gdalwarp_expected @@ -1,39 +1,60 @@ -NOTICE: table "raster_resample_src" does not exist, skipping -NOTICE: table "raster_resample_dst" does not exist, skipping +NOTICE: table "raster_gdalwarp_src" does not exist, skipping +NOTICE: table "raster_gdalwarp_dst" does not exist, skipping NOTICE: Values must be provided for both X and Y when specifying the scale. Returning original raster NOTICE: Values must be provided for both X and Y when specifying the scale. Returning original raster +NOTICE: Values must be provided for both X and Y when specifying the scale. Returning original raster +NOTICE: Values must be provided for both X and Y when specifying the scale. Returning original raster +0.0||||||||||||| +0.1|993310|12|12|1|1009.894|-1009.894|0.000|0.000|950732.188|1409281.783|t|t|t +0.10|992163|10|10|1|1000.000|-1000.000|0.000|0.000|-500000.000|600000.000|t|t|t +0.11|992163|11|10|1|1000.000|-1000.000|0.000|0.000|-500001.000|600000.000|t|t|t +0.12|992163|10|11|1|1000.000|-1000.000|0.000|0.000|-500000.000|600009.000|t|t|t +0.13|992163|11|11|1|1000.000|-1000.000|0.000|0.000|-500100.000|600950.000|t|t|t +0.14|992163|201|201|1|50.000|50.000|0.000|0.000|-500040.000|589957.000|t|t|t +0.15|992163|84|84|1|121.000|121.000|0.000|0.000|-500093.000|589875.000|t|t|t +0.16|993310|243|243|1|50.000|50.000|0.000|0.000|950710.000|1397157.000|t|t|t +0.17|993309|243|243|1|50.000|50.000|0.000|0.000|950760.000|1396957.000|t|t|t +0.18|992163|10|10|1|1000.000|-1000.000|3.000|3.000|-500030.000|600000.000|t|t|t +0.19|993310|12|12|1|1009.894|-1009.894|3.000|3.000|950691.792|1409281.783|t|t|t +0.2|993309|12|12|1|1009.916|-1009.916|0.000|0.000|950762.305|1409088.896|t|t|t +0.20|993309|12|12|1|1009.916|-1009.916|1.000|3.000|950742.107|1409088.896|t|t|t +0.21|993310|24|24|1|500.000|500.000|3.000|3.000|950657.188|1397356.783|t|t|t +0.22|993310|26|26|1|500.000|500.000|0.000|6.000|950452.000|1396632.000|t|t|t +0.23|984269|12|8|1|0.012|-0.012|0.000|0.000|-107.029|50.206|t|t|t +0.24|974269|12|8|1|0.012|-0.012|0.000|0.000|-107.029|50.206|t|t|t +0.3|994269|12|8|1|0.012|-0.012|0.000|0.000|-107.029|50.206|t|t|t +0.4|993310|24|24|1|500.000|500.000|0.000|0.000|950732.188|1397281.783|t|t|t +0.5|992163|10|10|1|1000.000|-1000.000|0.000|0.000|-500000.000|600000.000|t|t|t +0.6|992163|10|10|1|1000.000|-1000.000|0.000|0.000|-500000.000|600000.000|t|t|t +0.7|992163|20|20|1|500.000|500.000|0.000|0.000|-500000.000|590000.000|t|t|t +0.8|992163|40|40|1|250.000|250.000|0.000|0.000|-500000.000|590000.000|t|t|t +0.9|992163|40|40|1|250.000|250.000|0.000|0.000|-500000.000|590000.000|t|t|t 1.0||||||||||||| 1.1|992163|10|10|1|1000.000|-1000.000|0.000|0.000|-500000.000|600000.000|t|t|t -1.10|992163|40|40|1|250.000|250.000|0.000|0.000|-500000.000|590000.000|t|t|t -1.11|992163|10|10|1|1000.000|-1000.000|0.000|0.000|-500000.000|600000.000|t|t|t -1.12|992163|11|10|1|1000.000|-1000.000|0.000|0.000|-500001.000|600000.000|t|t|t -1.13|992163|10|11|1|1000.000|-1000.000|0.000|0.000|-500000.000|600009.000|t|t|t -1.14|992163|11|11|1|1000.000|-1000.000|0.000|0.000|-500100.000|600950.000|t|t|t +1.10|992163|10|11|1|1000.000|-1000.000|0.000|0.000|-500000.000|600009.000|t|t|t +1.11|992163|11|11|1|1000.000|-1000.000|0.000|0.000|-500100.000|600950.000|t|t|t +1.12|992163|201|201|1|50.000|50.000|0.000|0.000|-500040.000|589957.000|t|t|t +1.13|992163|84|84|1|121.000|121.000|0.000|0.000|-500093.000|589875.000|t|t|t +1.14|992163|201|201|1|50.000|50.000|0.000|0.000|-500040.000|589957.000|t|t|t 1.15|992163|201|201|1|50.000|50.000|0.000|0.000|-500040.000|589957.000|t|t|t -1.16|992163|84|84|1|121.000|121.000|0.000|0.000|-500093.000|589875.000|t|t|t -1.17|993310|243|243|1|50.000|50.000|0.000|0.000|950710.000|1397157.000|t|t|t -1.18|993309|243|243|1|50.000|50.000|0.000|0.000|950760.000|1396957.000|t|t|t -1.19|992163|10|10|1|1000.000|-1000.000|3.000|3.000|-500030.000|600000.000|t|t|t -1.2|993310|12|12|1|1009.894|-1009.894|0.000|0.000|950732.188|1409281.783|t|t|t -1.20|993310|12|12|1|1009.894|-1009.894|3.000|3.000|950691.792|1409281.783|t|t|t -1.21|993309|12|12|1|1009.916|-1009.916|1.000|3.000|950742.107|1409088.896|t|t|t -1.22|993310|24|24|1|500.000|500.000|3.000|3.000|950657.188|1397356.783|t|t|t -1.23|993310|26|26|1|500.000|500.000|0.000|6.000|950452.000|1396632.000|t|t|t -1.24|992163|207|101|1|50.000|-100.000|3.000|0.000|-500319.000|600056.000|t|t|t -1.25|992163|207|101|1|50.000|-100.000|3.000|0.000|-500319.000|600056.000|t|t|t -1.26|992163|150|150|1|66.667|-66.667|0.000|0.000|-500000.000|600000.000|t|t|t -1.27|993310|150|150|1|80.792|-80.792|0.000|0.000|950732.188|1409281.783|t|t|t -1.28|992163|5|5|1|2064.200|-2291.200|0.000|0.000|-500321.000|601456.000|t|t|t -1.29||||||||||||| -1.3|993309|12|12|1|1009.916|-1009.916|0.000|0.000|950762.305|1409088.896|t|t|t -1.30|984269|12|8|1|0.012|-0.012|0.000|0.000|-107.029|50.206|t|t|t -1.31|974269|12|8|1|0.012|-0.012|0.000|0.000|-107.029|50.206|t|t|t -1.4|994269|12|8|1|0.012|-0.012|0.000|0.000|-107.029|50.206|t|t|t -1.5|993310|24|24|1|500.000|500.000|0.000|0.000|950732.188|1397281.783|t|t|t -1.6|992163|10|10|1|1000.000|-1000.000|0.000|0.000|-500000.000|600000.000|t|t|t -1.7|992163|10|10|1|1000.000|-1000.000|0.000|0.000|-500000.000|600000.000|t|t|t -1.8|992163|20|20|1|500.000|500.000|0.000|0.000|-500000.000|590000.000|t|t|t -1.9|992163|40|40|1|250.000|250.000|0.000|0.000|-500000.000|590000.000|t|t|t +1.16|992163|10|10|1|1000.000|-1000.000|3.000|3.000|-500030.000|600000.000|t|t|t +1.17|992163|10|10|1|1000.000|-1000.000|3.000|3.000|-500030.000|600000.000|t|t|t +1.18|992163|10|10|1|1000.000|-1000.000|1.000|3.000|-500010.000|600000.000|t|t|t +1.19|992163|20|20|1|500.000|500.000|3.000|3.000|-500065.000|590065.000|t|t|t +1.2|992163|20|20|1|500.000|500.000|0.000|0.000|-500000.000|590000.000|t|t|t +1.20|992163|21|21|1|500.000|500.000|0.000|6.000|-500048.000|590038.000|t|t|t +1.21|992163|207|101|1|50.000|-100.000|3.000|0.000|-500319.000|600056.000|t|t|t +1.22|992163|207|101|1|50.000|-100.000|3.000|0.000|-500319.000|600056.000|t|t|t +1.23|992163|150|150|1|66.667|-66.667|0.000|0.000|-500000.000|600000.000|t|t|t +1.24|992163|5|5|1|2064.200|-2291.200|0.000|0.000|-500321.000|601456.000|t|t|t +1.25||||||||||||| +1.3|992163|10|10|1|1000.000|-1000.000|0.000|0.000|-500000.000|600000.000|t|t|t +1.4|992163|10|10|1|1000.000|-1000.000|0.000|0.000|-500000.000|600000.000|t|t|t +1.5|992163|20|20|1|500.000|500.000|0.000|0.000|-500000.000|590000.000|t|t|t +1.6|992163|40|40|1|250.000|250.000|0.000|0.000|-500000.000|590000.000|t|t|t +1.7|992163|40|40|1|250.000|250.000|0.000|0.000|-500000.000|590000.000|t|t|t +1.8|992163|10|10|1|1000.000|-1000.000|0.000|0.000|-500000.000|600000.000|t|t|t +1.9|992163|11|10|1|1000.000|-1000.000|0.000|0.000|-500001.000|600000.000|t|t|t 2.1|993310|12|12|1|1009.894|-1009.894|0.000|0.000|950732.188|1409281.783|t|t|t 2.10|993310|24|24|1|500.000|500.000|0.000|0.000|950732.188|1397281.783|t|t|t 2.11|993309|121|121|1|100.000|100.000|0.000|0.000|950762.305|1396988.896|t|t|t