0

I have created a topology schema 'parcele_topo' with the default tables edge_data, face, node and relation. I also imported a polygon shapefile to this schema using shp2pgsql-gui as table 'parcele_tsur_116'. I added a topogeometry column (named 'topo') to this table using:

select topology.addtopogeometrycolumn('parcele_topo','parcele_topo','parcele_tsur_116','topo','polygon');

This is the topology summary:

Topology parcele_topo (id 3, SRID 2462, precision 0.005)0 nodes, 0 edges, 0 faces, 0 topogeoms in 0 layers Layer 1, type Polygonal (3), 0 topogeoms Deploy: parcele_topo.parcele_tsur_116.topo

And this is the screenshot:

enter image description here

Now I want to convert this simple table to topogeometry layer inside this topology schema so I can use topological analyses.

2

1- Create topology schema

select topology.createtopology('schema',srid,tolerance);

2-Create table structure identical the one that will be converted

create table schema.table2 
(like schema.table1 including all);

3-Add topogeometry column to the table

select topology.addtopogeometrycolumn('schema','yourtopology','table2','topo','polygon');

4-Check the topology info

select topology_id,layer_id,schema_name as sn,feature_column as fc
from topology.layer;

select * from topology.topologysummary('yourtopology');

5-If everything is set up, proceed to the insertion of the data

insert into schema.table2(attribute1,topo)
select attribute1,topology.totopogeom(geom,'yourtopology',1)
from schema.table1;

Reference material:

https://postgis.net/docs/toTopoGeom.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.