Schema
Owner
postgres
Descriptions
args: rast, pt - Returns the upper left corner as column and row given geometric X and Y (longitude and latitude) or a point geometry expressed in the spatial reference coordinate system of the raster.
Options
Option | Value |
---|---|
Returns |
record |
Language |
|
Parameters |
rast public.raster pt public.geometry out columnx integer out rowy integer |
Definition
CREATE OR REPLACE FUNCTION public.st_worldtorastercoord (
rast public.raster,
pt public.geometry,
out columnx integer,
out rowy integer
)
RETURNS record AS
$span$
DECLARE
rx integer;
ry integer;
BEGIN
IF st_geometrytype(pt) != 'ST_Point' THEN
RAISE EXCEPTION 'Attempting to compute raster coordinate with a non-point geometry';
END IF;
IF ST_SRID(rast) != ST_SRID(pt) THEN
RAISE EXCEPTION 'Raster and geometry do not have the same SRID';
END IF;
SELECT rc.columnx AS x, rc.rowy AS y INTO columnx, rowy FROM _st_worldtorastercoord($1, st_x(pt), st_y(pt)) AS rc;
RETURN;
END;
$span$
LANGUAGE 'plpgsql'
IMMUTABLE
RETURNS NULL ON NULL INPUT
SECURITY INVOKER
COST 100;
COMMENT ON FUNCTION public.st_worldtorastercoord(rast public.raster, pt public.geometry, out columnx integer, out rowy integer)
IS 'args: rast, pt - Returns the upper left corner as column and row given geometric X and Y (longitude and latitude) or a point geometry expressed in the spatial reference coordinate system of the raster.';
This file was generated with SQL Manager for PostgreSQL (www.pgsqlmanager.com) at 13/03/2014 13:23 |