25

I'm currently using PostGIS topology extension, but I have some difficulties in understanding how the structure works:

One of the key points is the use of "layer"s: as of what I understand, features attributes should be stored in a table out of the topology's schema (the one named topo_actualname) and registered as a layer of that topology with AddTopoGeometryColumn.

However, is there a simple way to join the attributes (stored in the layer table) with the respective features (elements in the node, face, or edge_data)?

Now, what I do is:

SELECT whatever FROM layer_tb l JOIN topo_topologyname.edge_data e ON (l.topo).id=edge_id; 

But I guess the whole layer concept is rather useless if I have to know both the topology schema name and the layer name to get the information I want.

In fact, I think I understood that the topo column on the layer has enough information to know where the respective topology is, and moreover the topology schema stores a reference to each layer table for each topology.

Is there a short/simple/proper way to join information together? I was looking for something in the topology extension functions, but couldn't find anything useful.

2
  • 3
    I'm a bit lost on how you're supposed to leverage topologies, too, but this might help. You can cast a TopoGeometry directly to a geometry: SELECT whatever, ST_AsText(topogeom::geometry) FROM layer_tb. The thing is that if the edges get split later on, it seems that the geometry might change as a result. Commented Aug 27, 2014 at 1:47
  • 1
    What you want are tools or data operations such as intersect, union, or merge. QGIS works with post GIS and is free and has tools like this. Features are in the layer and are joined when you merge layers based on those types of operations. Commented Jul 5, 2017 at 22:09

1 Answer 1

1

The mapping of the attributes to the topology is not direct. The relationship is something like this for a node:

your_topogeom -> (topogeom_id) relation table (element_id)-> (node_id) node 

So your select statement would be more like this:

SELECT whatever FROM layer_tb l INNER JOIN relation AS r ON (((l.mytopogeom).id , (l.mytopogeom).layer_id)) = (r.topogeo_id, r.layer_id ) INNER JOIN edge_data AS e ON (r.element_id = e.edge_id) 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.