Addition of ST_PixelAsPoints and ST_PixelAsCentroids

git-svn-id: http://svn.osgeo.org/postgis/trunk@10024 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Bborie Park 2012-07-03 22:30:13 +00:00
parent a643daa98b
commit d4f05e108b
2 changed files with 56 additions and 2 deletions

View file

@ -2532,7 +2532,7 @@ CREATE OR REPLACE FUNCTION st_pixelaspolygons(
LANGUAGE 'sql' IMMUTABLE STRICT;
-----------------------------------------------------------------------
-- ST_PixelAsPolygons
-- ST_PixelAsPolygon
-----------------------------------------------------------------------
CREATE OR REPLACE FUNCTION st_pixelaspolygon(rast raster, x integer, y integer)
@ -2540,6 +2540,58 @@ CREATE OR REPLACE FUNCTION st_pixelaspolygon(rast raster, x integer, y integer)
AS $$ SELECT geom FROM _st_pixelaspolygons($1, NULL, $2, $3) $$
LANGUAGE 'sql' IMMUTABLE STRICT;
-----------------------------------------------------------------------
-- ST_PixelAsPoints
-----------------------------------------------------------------------
CREATE OR REPLACE FUNCTION st_pixelaspoints(
rast raster,
band integer DEFAULT 1,
exclude_nodata_value boolean DEFAULT TRUE,
OUT geom geometry,
OUT val double precision,
OUT x int,
OUT y int
)
RETURNS SETOF record
AS $$ SELECT ST_PointN(ST_ExteriorRing(geom), 1), val, x, y FROM _st_pixelaspolygons($1, $2, NULL, NULL, $3) $$
LANGUAGE 'sql' IMMUTABLE STRICT;
-----------------------------------------------------------------------
-- ST_PixelAsPoint
-----------------------------------------------------------------------
CREATE OR REPLACE FUNCTION st_pixelaspoint(rast raster, x integer, y integer)
RETURNS geometry
AS $$ SELECT ST_PointN(ST_ExteriorRing(geom), 1) FROM _st_pixelaspolygons($1, NULL, $2, $3) $$
LANGUAGE 'sql' IMMUTABLE STRICT;
-----------------------------------------------------------------------
-- ST_PixelAsCentroids
-----------------------------------------------------------------------
CREATE OR REPLACE FUNCTION st_pixelascentroids(
rast raster,
band integer DEFAULT 1,
exclude_nodata_value boolean DEFAULT TRUE,
OUT geom geometry,
OUT val double precision,
OUT x int,
OUT y int
)
RETURNS SETOF record
AS $$ SELECT ST_Centroid(geom), val, x, y FROM _st_pixelaspolygons($1, $2, NULL, NULL, $3) $$
LANGUAGE 'sql' IMMUTABLE STRICT;
-----------------------------------------------------------------------
-- ST_PixelAsCentroid
-----------------------------------------------------------------------
CREATE OR REPLACE FUNCTION st_pixelascentroid(rast raster, x integer, y integer)
RETURNS geometry
AS $$ SELECT ST_Centroid(geom) FROM _st_pixelaspolygons($1, NULL, $2, $3) $$
LANGUAGE 'sql' IMMUTABLE STRICT;
-----------------------------------------------------------------------
-- Raster Utility Functions
-----------------------------------------------------------------------

View file

@ -83,7 +83,9 @@ TEST_BANDPROPS = \
rt_neighborhood \
rt_nearestvalue \
rt_pixelofvalue \
rt_pixelaspolygons.sql
rt_pixelaspolygons \
rt_pixelaspoints \
rt_pixelascentroids
TEST_UTILITY = \
rt_utility \