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

Function: polygonize

 

 

Schema

topology

 

Owner

postgres

 

Descriptions

args: toponame - Find and register all faces defined by topology edges

 

Options

Option

Value

Returns

text

Language

plpgsql

Parameters

toponame varchar

 

Definition

CREATE OR REPLACE FUNCTION topology.polygonize (
 toponame varchar
)
RETURNS text AS
$span$
DECLARE

 sql text;
 rec RECORD;
 faces int;
BEGIN

 sql := 'SELECT (st_dump(st_polygonize(geom))).geom from '
        || quote_ident(toponame) || '.edge_data';

 faces = 0;
 FOR rec in EXECUTE sql LOOP
   BEGIN
     PERFORM
topology.AddFace(toponame, rec.geom);
     faces = faces + 1;
   EXCEPTION
     WHEN
OTHERS THEN
       RAISE
WARNING 'Error registering face % (%)', rec.geom, SQLERRM;
   END;
 END LOOP;
 RETURN faces || ' faces registered';
END
$span$
LANGUAGE
'plpgsql'
VOLATILE
CALLED ON NULL INPUT
SECURITY INVOKER
COST
100;

COMMENT ON FUNCTION topology.polygonize(toponame varchar)
IS 'args: toponame - Find and register all faces defined by topology edges';

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