CreateTopology — Creates a new topology schema and registers it in the topology.topology table.
integer CreateTopology(
name topology_schema_name, integer srid, double precision prec, boolean hasz, integer topoid, boolean useslargeids)
;
Creates a new topology schema with name topology_name
and registers it in the topology.topology
table. Topologies must be uniquely named. The topology tables (edge_data
, face
, node
,and relation
are created in the schema. It returns the id of the topology.
The srid
is the spatial reference system SRID for the topology. The SRID defaults to -1 (unknown) if not specified.
The tolerance prec
is measured in the units of the spatial reference system. The tolerance defaults to 0.
hasz
defaults to false if not specified.
topoid
optional explicit identifier (allows deterministic topology id assignment, needs to be unique)
useslargeids
optional, defaults to false. If true, the topology will be created to support large ids (int8) for topology and primitive ids.
This is similar to the SQL/MM ST_InitTopoGeo but has more functionality.
Availability: 1.1
Enhanced: 2.0 added the signature accepting hasZ
Create a topology schema called ma_topo
that stores edges and nodes in Massachusetts State Plane-meters (SRID = 26986). The tolerance represents 0.5 meters since the spatial reference system is meter-based.
SELECT topology.CreateTopology('ma_topo', 26986, 0.5);
Create a topology for Rhode Island called ri_topo
in spatial reference system State Plane-feet (SRID = 3438)
SELECT topology.CreateTopology('ri_topo', 3438) AS topoid; topoid ------ 2