toTopoGeom — Convierte un Geometry simple en una geometría topo.
topogeometry toTopoGeom(geometry geom, varchar toponame, integer layer_id, float8 tolerance=-1);
topogeometry toTopoGeom(geometry geom, topogeometry topogeom, float8 tolerance=-1);
Convierte una geometría simple en un TopoGeometry.
Las primitivas topológicas necesarias para representar la geometría de entrada se añadirán a la topología subyacente, posiblemente dividiendo los existentes, y se asociarán con la salida TopoGeometry en la tabla relation.
Los objetos TopoGeometry existentes (con la posible excepción de topogeomsi se les da) conservarán sus formas.
When tolerance is given it will be used to snap the input geometry to existing primitives. The special value -1 (default) means use the topology precision as tolerance.
En la primera forma se creará un nuevo TopoGeometry para la capa dada (layer_id) de la topología dada (toponame).
En la segunda forma las primitivas resultantes de la conversión se añadirán a la TopoGeometry preexistente (topogeom), añadiendo posiblemente espacio a su forma final. Para que la nueva forma Reemplace completamente la antigua ver clearTopoGeom.
Disponibilidad: 2.0
Mejorado: 2.1.0 agrega la versión tomando una TopoGeometry existente.
Changed: 3.7.0 changes meaning of tolerance 0 to really mean 0 and -1 (new default) to request using the topology precision.
Se trata de un flujo de trabajo autónomo completo
Create the topology without allowing any tolerance.
SELECT topology.CreateTopology('topo_boston_test', 2249);
Create a new table.
CREATE TABLE nei_topo(gid serial primary key, nei varchar(30));
Add a topogeometry column to the new table.
SELECT topology.AddTopoGeometryColumn('topo_boston_test', 'public', 'nei_topo', 'topo', 'MULTIPOLYGON') AS new_layer_id;
1
Use the new layer identifier to populate the topogeometry column.
INSERT INTO nei_topo(nei, topo) SELECT nei, topology.toTopoGeom(geom, 'topo_boston_test', 1) FROM neighborhoods WHERE gid BETWEEN 1 and 15;
Verify what happened.
SELECT * FROM
topology.TopologySummary('topo_boston_test');
Topology topo_boston_test (5), SRID 2249, precision 0 61 nodes, 87 edges, 35 faces, 15 topogeoms in 1 layers Layer 1, type Polygonal (3), 15 topogeoms Deploy: public.nei_topo.topo
Shrink all TopoGeometry polygons by 10 meters.
UPDATE nei_topo SET topo = toTopoGeom(ST_Buffer(topo, -10), clearTopoGeom(topo), 0);
Find faces that are left without any TopoGeometry reference after the shrink operation.
SELECT ST_GetFaceGeometry('topo_boston_test', f.face_id)
FROM topo_boston_test.face f
WHERE f.face_id
> 0
AND NOT EXISTS (
SELECT * FROM topo_boston_test.relation
WHERE layer_id = 1 AND element_id = f.face_id
);
CreateTopology, AddTopoGeometryColumn, CreateTopoGeom, TopologySummary, clearTopoGeom