I have created a PostGIS topology table by importing a shapefile and following a tutorial online. I can now load the edges and nodes into QGIS. But I am not seeing the edges and nodes tables anywhere when I look at the database in PgAdmin. Where are they being stored? I am making modifications to the edges and nodes tables in QGIS and I need to verify that they are being added properly.
1 Answer
Topology functions are stored in the topology
schema, topology data (edges, faces, nodes, relations) are stored in a user-defined schema, and relations (topo id, layer id, element id, element type) are stored with the geometry data.
From the command line you can view tables in the topology
schema with:
SELECT *
FROM information_schema.tables
WHERE table_schema = 'topology';
With pgAdminIII it looks like this:
Once you create a topology and add data to a layer in that topology, then the topology.topology
and topology.layer
tables will each have one record in them.
Creating the toplogy with CreateTopology would look like this:
SELECT topology.CreateTopology('me_topo', 4326, 0.0001);
And adding data to that topology with AddTopoGeometryColumn would look something like this:
SELECT topology.AddTopoGeometryColumn('me_topo', 'public', 'me_counties', 'topo', 'MULTIPOLYGON');
Finally set the topology data in the new topo
column with toTopoGeom:
UPDATE me_counties SET topo = topology.toTopoGeom(geom, 'me_topo', 1);
Now you will be able to see the edge, face and node data in the me_topo
schema:
-
1Actually the topology schema only contains the topology functions and support tables. The data that is in the topology is stored in the schema specified in the CreateTopology command. In that example above you'll get a schema called "me_topo" and in that schema you'll find tables with edges, nodes, faces, and relations. Commented Feb 23, 2017 at 20:47
-
You got me @HeyOverThere! Edited to improve the explanation of what functions and data live where.– katahdinCommented Feb 23, 2017 at 21:06
-
@1saac did this answer your question? If so please select it as answered :)– katahdinCommented Feb 24, 2017 at 14:41