PostGIS

CreateTopology

Prev

10.5. Topology Constructors

Next

Name

CreateTopology — Creates a new topology schema and registers this new schema in the topology.topology table.

Synopsis

integer +`*`+CreateTopology*(`varchar `topology_schema_name`)`;

integer +`*`+CreateTopology*(`varchar `topology_schema_name, integer srid`)`;

integer +`*`+CreateTopology*(`varchar `topology_schema_name, integer srid, double precision prec`)`;

integer +`*`+CreateTopology*(`varchar `topology_schema_name, integer srid, double precision prec, boolean hasz`)`;

Description

Creates a new schema with name topology_name consisting of tables (edge_data,face,node, relation and registers this new topology in the topology.topology table. It returns the id of the topology in the topology table. The srid is the spatial reference identified as defined in spatial_ref_sys table for that topology. Topologies must be uniquely named. The tolerance is measured in the units of the spatial reference system. If the tolerance (prec) is not specified defaults to 0.

This is similar to the SQL/MM ST_InitTopoGeo but a bit more functional. hasz defaults to false if not specified.

Availability: 1.1

Enhanched: 2.0 added the signature accepting hasZ

Examples

This example creates a new schema called ma_topo that will store edges, faces, and relations in Massachusetts State Plane meters. The tolerance represents 1/2 meter since the spatial reference system is a meter based spatial reference system

SELECT topology.CreateTopology('ma_topo',26986, 0.5);

Create Rhode Island topology in State Plane ft

SELECT topology.CreateTopology('ri_topo',3438) As topoid;
topoid
------
2