toTopoGeom — Converts a simple Geometry into a topo geometry.
topogeometry toTopoGeom(geometry geom, varchar toponame, integer layer_id, float8 tolerance=-1);
topogeometry toTopoGeom(geometry geom, topogeometry topogeom, float8 tolerance=-1);
Converte uma simples geometria em TopoGeometry.
Topológicos primitivos requeridos para representar a geometria de entrada será adicionada a topologia oculta, possivelmente dividindo as existentes, e elas serão associadas com a TopoGeometria de saída na table relation.
Objetos existentes de TopoGeometria (com a possível exceção de topogeom, se dada) manterão suas 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.
Na primeira forma, uma nova TopoGeometria será criada para a dada camada (layer_id) da topologia (toponame)
Na segunda forma, as rpimitivs resultantes da conversão serão adicionadas a uma TopoGeometria pre existente (topogeom), adicionando, possivelmente, espaço à sua forma final. Para obter a nova forma completamente substituir a antiga, veja clearTopoGeom.
Disponibilidade: 2.0
Melhorias: 2.1.0 adiciona a versão pegando uma TopoGeometria existente.
Changed: 3.7.0 changes meaning of tolerance 0 to really mean 0 and -1 (new default) to request using the topology precision.
Este é um fluxo de trabalho auto contido 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