CreateTopology — Creates a new topology schema and registers it in the topology.topology table.
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)
;
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 tolerance prec
is measured in the units of the spatial reference system. The tolerance defaults to 0.
hasz
defaults to false if not specified.
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