Schema
Owner
postgres
Descriptions
args: geom, ref, pixeltype=ARRAY['8BUI'], value=ARRAY[1], nodataval=ARRAY[0], touched=false - Converts a PostGIS geometry to a PostGIS raster.
Options
Option | Value |
---|---|
Returns |
public.raster |
Language |
|
Parameters |
geom public.geometry ref public.raster pixeltype text [] = ARRAY['8BUI'::text] value double precision [] = ARRAY[1::double precision] nodataval double precision [] = ARRAY[0::double precision] touched boolean = false |
Definition
CREATE OR REPLACE FUNCTION public.st_asraster (
geom public.geometry,
ref public.raster,
pixeltype text [] = ARRAY['8BUI'::text],
value double precision [] = ARRAY[1::double precision],
nodataval double precision [] = ARRAY[0::double precision],
touched boolean = false
)
RETURNS public.raster AS
$span$
DECLARE
g geometry;
g_srid integer;
ul_x double precision;
ul_y double precision;
scale_x double precision;
scale_y double precision;
skew_x double precision;
skew_y double precision;
sr_id integer;
BEGIN
SELECT upperleftx, upperlefty, scalex, scaley, skewx, skewy, srid INTO ul_x, ul_y, scale_x, scale_y, skew_x, skew_y, sr_id FROM ST_Metadata(ref);
--RAISE NOTICE '%, %, %, %, %, %, %', ul_x, ul_y, scale_x, scale_y, skew_x, skew_y, sr_id;
-- geometry and raster has different SRID
g_srid := ST_SRID(geom);
IF g_srid != sr_id THEN
RAISE NOTICE 'The geometry''s SRID (%) is not the same as the raster''s SRID (%). The geometry will be transformed to the raster''s projection', g_srid, sr_id;
g := ST_Transform(geom, sr_id);
ELSE
g := geom;
END IF;
RETURN _st_asraster(g, scale_x, scale_y, NULL, NULL, $3, $4, $5, NULL, NULL, ul_x, ul_y, skew_x, skew_y, $6);
END;
$span$
LANGUAGE 'plpgsql'
STABLE
CALLED ON NULL INPUT
SECURITY INVOKER
COST 100;
COMMENT ON FUNCTION public.st_asraster(geom public.geometry, ref public.raster, pixeltype text [], value double precision [], nodataval double precision [], touched boolean)
IS 'args: geom, ref, pixeltype=ARRAY[''8BUI''], value=ARRAY[1], nodataval=ARRAY[0], touched=false - Converts a PostGIS geometry to a PostGIS raster.';
This file was generated with SQL Manager for PostgreSQL (www.pgsqlmanager.com) at 13/03/2014 13:23 |