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

Function: gettopogeomelementarray

 

 

Schema

topology

 

Owner

postgres

 

Descriptions

args: toponame, layer_id, tg_id - Returns a topoelementarray (an array of topoelements) containing the topological elements and type of the given TopoGeometry (primitive elements)

 

Options

Option

Value

Returns

topology.topoelementarray

Language

plpgsql

Parameters

toponame varchar

layer_id integer

tgid integer

 

Definition

CREATE OR REPLACE FUNCTION topology.gettopogeomelementarray (
 toponame varchar,
 layer_id integer,
 tgid integer
)
RETURNS topology.topoelementarray AS
$span$
DECLARE

 rec RECORD;
 tg_objs varchar := '{';
 i integer;
 query text;
BEGIN

 query = 'SELECT * FROM topology.GetTopoGeomElements('
   || quote_literal(toponame) || ','
   || quote_literal(layer_id) || ','
   || quote_literal(tgid)
   || ') as obj ORDER BY obj';


 -- TODO: why not using array_agg here ?

 i = 1;
 FOR rec IN EXECUTE query
 LOOP
   IF
i > 1 THEN
     tg_objs = tg_objs || ',';
   END IF;
   tg_objs = tg_objs || '{'
     || rec.obj[1] || ',' || rec.obj[2]
     || '}';
   i = i+1;
 END LOOP;

 tg_objs = tg_objs || '}';

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

COMMENT ON FUNCTION topology.gettopogeomelementarray(toponame varchar, layer_id integer, tgid integer)
IS 'args: toponame, layer_id, tg_id - Returns a topoelementarray (an array of topoelements) containing the topological elements and type of the given TopoGeometry (primitive elements)';

This file was generated with SQL Manager for PostgreSQL (www.pgsqlmanager.com) at 13/03/2014 13:23
Previous topic Chapter index Next topic