From 1dbfa825504d9837b31ac25eef363938cb9b5681 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Mon, 5 Mar 2012 12:24:48 +0000 Subject: [PATCH] Add GetTopologySRID (#1182) git-svn-id: http://svn.osgeo.org/postgis/trunk@9399 b70326c6-7e19-0410-871a-916f4a2858ee --- doc/extras_topology.xml | 59 ++++++++++++++++++++++++++++++++++++-- topology/topology.sql.in.c | 15 ++++++++++ 2 files changed, 72 insertions(+), 2 deletions(-) diff --git a/doc/extras_topology.xml b/doc/extras_topology.xml index 77504c0ff..5476ef463 100644 --- a/doc/extras_topology.xml +++ b/doc/extras_topology.xml @@ -1819,7 +1819,57 @@ ERROR: Two or more faces found See Also - , , + + , + , + , + + + + + + + + GetTopologySRID + + Returns the SRID of a topology in the topology.topology table given the name of the topology. + + + + + + integer GetTopologyID + varchar toponame + + + + + + Description + + Returns the spatial reference id of a topology in the topology.topology table given the name of the topology. + + Availability: 2.0.0 + + + + + Examples + SELECT topology.GetTopologySRID('ma_topo') As SRID; + SRID +------- + 4326 + + + + + See Also + + , + , + , + + @@ -1859,7 +1909,12 @@ ERROR: Two or more faces found See Also - , , + + , + , + , + + diff --git a/topology/topology.sql.in.c b/topology/topology.sql.in.c index 0e0d5a2d1..4273ece4d 100644 --- a/topology/topology.sql.in.c +++ b/topology/topology.sql.in.c @@ -53,6 +53,7 @@ -- topology.topology table -- -- FUNCTION GetTopologyId(name) +-- FUNCTION GetTopologySRID(name) -- FUNCTION GetTopologyName(id) -- Return info about a Topology -- @@ -956,6 +957,8 @@ $$ LANGUAGE 'sql' VOLATILE STRICT; --{ -- GetTopologyName(topology_id) -- +-- TODO: rewrite in SQL ? +-- CREATE OR REPLACE FUNCTION topology.GetTopologyName(topoid integer) RETURNS varchar AS @@ -974,6 +977,8 @@ LANGUAGE 'plpgsql' STABLE STRICT; --{ -- GetTopologyId(toponame) -- +-- TODO: rewrite in SQL ? +-- CREATE OR REPLACE FUNCTION topology.GetTopologyId(toponame varchar) RETURNS integer AS @@ -988,6 +993,16 @@ END $$ LANGUAGE 'plpgsql' STABLE STRICT; --} GetTopologyId(toponame) + +--{ +-- GetTopologySRID(toponame) +-- +CREATE OR REPLACE FUNCTION topology.GetTopologySRID(toponame varchar) + RETURNS integer +AS $$ + SELECT SRID FROM topology.topology WHERE name = $1; +$$ LANGUAGE 'sql' STABLE STRICT; +--} GetTopologySRID(toponame) -- 2.40.0