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

Function: st_georeference

 

 

Schema

public

 

Owner

postgres

 

Descriptions

args: rast, format=GDAL - Returns the georeference meta data in GDAL or ESRI format as commonly seen in a world file. Default is GDAL.

 

Options

Option

Value

Returns

text

Language

plpgsql

Parameters

rast public.raster

format text = 'GDAL'::text

 

Definition

CREATE OR REPLACE FUNCTION public.st_georeference (
 rast public.raster,
 format text = 'GDAL'::text
)
RETURNS text AS
$span$
   DECLARE

scale_x numeric;
scale_y numeric;
skew_x numeric;
skew_y numeric;
ul_x numeric;
ul_y numeric;

       result text;
   BEGIN
SELECT
scalex::numeric, scaley::numeric, skewx::numeric, skewy::numeric, upperleftx::numeric, upperlefty::numeric
INTO scale_x, scale_y, skew_x, skew_y, ul_x, ul_y FROM public.ST_Metadata(rast);

-- scale x
           result := trunc(scale_x, 10) || E'\n';

-- skew y
           result := result || trunc(skew_y, 10) || E'\n';

-- skew x
           result := result || trunc(skew_x, 10) || E'\n';

-- scale y
           result := result || trunc(scale_y, 10) || E'\n';

       IF format = 'ESRI' THEN
-- upper left x
           result := result || trunc((ul_x + scale_x * 0.5), 10) || E'\n';

-- upper left y
           result = result || trunc((ul_y + scale_y * 0.5), 10) || E'\n';
       ELSE -- IF format = 'GDAL' THEN
-- upper left x

           result := result || trunc(ul_x, 10) || E'\n';

-- upper left y
           result := result || trunc(ul_y, 10) || E'\n';
       END IF;

       RETURN result;
   END;
$span$
LANGUAGE
'plpgsql'
IMMUTABLE
RETURNS NULL ON NULL INPUT
SECURITY INVOKER
COST
100;

COMMENT ON FUNCTION public.st_georeference(rast public.raster, format text)
IS 'args: rast, format=GDAL - Returns the georeference meta data in GDAL or ESRI format as commonly seen in a world file. Default is GDAL.';

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