From d432dc28e5af41edbace5381bf6dfdef3966c2e9 Mon Sep 17 00:00:00 2001 From: Bborie Park Date: Wed, 24 Aug 2011 15:23:25 +0000 Subject: [PATCH] Inclusion of missing ST_PixelWidth and ST_PixelHeight functions and regression tests. Associated ticket is #928 git-svn-id: http://svn.osgeo.org/postgis/trunk@7779 b70326c6-7e19-0410-871a-916f4a2858ee --- raster/rt_pg/rtpostgis.sql.in.c | 10 ++++++++++ raster/test/regress/Makefile.in | 1 + raster/test/regress/rt_pixelsize.sql | 24 +++++++++++++++++++++++ raster/test/regress/rt_pixelsize_expected | 0 4 files changed, 35 insertions(+) create mode 100644 raster/test/regress/rt_pixelsize.sql create mode 100644 raster/test/regress/rt_pixelsize_expected diff --git a/raster/rt_pg/rtpostgis.sql.in.c b/raster/rt_pg/rtpostgis.sql.in.c index 8d66a3ec1..7db90815e 100644 --- a/raster/rt_pg/rtpostgis.sql.in.c +++ b/raster/rt_pg/rtpostgis.sql.in.c @@ -135,6 +135,16 @@ CREATE OR REPLACE FUNCTION st_width(raster) AS 'MODULE_PATHNAME','RASTER_getWidth' LANGUAGE 'C' IMMUTABLE STRICT; +CREATE OR REPLACE FUNCTION st_pixelwidth(raster) + RETURNS float8 + AS 'MODULE_PATHNAME', 'RASTER_getPixelWidth' + LANGUAGE 'C' IMMUTABLE STRICT; + +CREATE OR REPLACE FUNCTION st_pixelheight(raster) + RETURNS float8 + AS 'MODULE_PATHNAME', 'RASTER_getPixelHeight' + LANGUAGE 'C' IMMUTABLE STRICT; + CREATE OR REPLACE FUNCTION st_rotation(raster) RETURNS float8 AS 'MODULE_PATHNAME','RASTER_getRotation' diff --git a/raster/test/regress/Makefile.in b/raster/test/regress/Makefile.in index 2a86cbe5f..6b55e3929 100644 --- a/raster/test/regress/Makefile.in +++ b/raster/test/regress/Makefile.in @@ -54,6 +54,7 @@ TEST_PROPS = \ create_rt_properties_test.sql \ rt_dimensions.sql \ rt_scale.sql \ + rt_pixelsize.sql \ rt_upperleft.sql \ rt_rotation.sql \ rt_georeference.sql \ diff --git a/raster/test/regress/rt_pixelsize.sql b/raster/test/regress/rt_pixelsize.sql new file mode 100644 index 000000000..af49728f4 --- /dev/null +++ b/raster/test/regress/rt_pixelsize.sql @@ -0,0 +1,24 @@ +----------------------------------------------------------------------- +-- $Id$ +-- +-- Copyright (c) 2011 David Zwarg +-- +-- This is free software; you can redistribute and/or modify it under +-- the terms of the GNU General Public Licence. See the COPYING file. +----------------------------------------------------------------------- + +----------------------------------------------------------------------- +-- st_pixelwidth +----------------------------------------------------------------------- + +SELECT id, name, scalex, skewy + FROM rt_properties_test + WHERE NOT sqrt(scalex*scalex + skewy*skewy) = st_pixelwidth(rast); + +----------------------------------------------------------------------- +-- st_pixelheight +----------------------------------------------------------------------- + +SELECT id, name, scaley, skewx + FROM rt_properties_test + WHERE NOT sqrt(scaley*scaley + skewx*skewx) = st_pixelheight(rast); diff --git a/raster/test/regress/rt_pixelsize_expected b/raster/test/regress/rt_pixelsize_expected new file mode 100644 index 000000000..e69de29bb -- 2.50.0