pggeodb.nancy.inra.fr/db_robot - db_robot on pggeodb.nancy.inra.fr
Previous topic Chapter index Next topic

Function: st_resample

 

 

Schema

public

 

Owner

albenard

 

Descriptions

args: rast, ref, algorithm=NearestNeighbour, maxerr=0.125, usescale=true - 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.

 

Options

Option

Value

Returns

public.raster

Language

plpgsql

Parameters

rast public.raster

ref public.raster

algorithm text = 'NearestNeighbour'::text

maxerr double precision = 0.125

usescale boolean = true

 

Definition

CREATE OR REPLACE FUNCTION public.st_resample (
 rast public.raster,
 ref public.raster,
 algorithm text = 'NearestNeighbour'::text,
 maxerr double precision = 0.125,
 usescale boolean = true
)
RETURNS public.raster AS
$span$
DECLARE

rastsrid int;

_srid int;
_dimx int;
_dimy int;
_scalex double precision;
_scaley double precision;
_gridx double precision;
_gridy double precision;
_skewx double precision;
_skewy double precision;
BEGIN
SELECT
srid, width, height, scalex, scaley, upperleftx, upperlefty, skewx, skewy INTO _srid, _dimx, _dimy, _scalex, _scaley, _gridx, _gridy, _skewx, _skewy FROM st_metadata($2);

rastsrid := public.ST_SRID($1);

-- both rasters must have the same SRID
IF (rastsrid != _srid) THEN
RAISE EXCEPTION
'The raster to be resampled has a different SRID from the reference raster';
RETURN NULL;
END IF;

IF usescale IS TRUE THEN
_dimx := NULL;
_dimy := NULL;
ELSE
_scalex := NULL;
_scaley := NULL;
END IF;

RETURN public._ST_gdalwarp($1, $3, $4, NULL, _scalex, _scaley, _gridx, _gridy, _skewx, _skewy, _dimx, _dimy);
END;
$span$
LANGUAGE
'plpgsql'
STABLE
RETURNS NULL ON NULL INPUT
SECURITY INVOKER
COST
100;

COMMENT ON FUNCTION public.st_resample(rast public.raster, ref public.raster, algorithm text, maxerr double precision, usescale boolean)
IS 'args: rast, ref, algorithm=NearestNeighbour, maxerr=0.125, usescale=true - 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.';

This file was generated with SQL Manager for PostgreSQL (www.pgsqlmanager.com) at 26/02/2014 11:51
Previous topic Chapter index Next topic