I have a network of roads and I would like to obtain a graph made by edges, each of them delimited by a origin node and a end node, such as the picture shows.

Edges with nodes

I would like to obtain a table made of rows like this

"edge_id, origin_node_id, end_node_id, origin_node_X, origin_node_Y, end_node_X, end_node_Y"

for example, for the a12 edge: "a12, 48.1234, 50.0000, 48.1335, 49.1111", where the origin node 1 coordinates are (48.1234,50.0000) and the end node 2 coordinates are (48.1335,49.1111). I used the field calculator with these expressions:


to get "origin_node_X,origin_node_Y,end_node_X,end_node_Y".

Now I am searching for a way to obtain the id of nodes which obviously are in another layer.

So I think that I could need a field calculator expression or python code to relate nodes' layer with edges' layer. I think that "get_feature" could be useful but at the moment I did not find the right way to use it. Another option is to make a text output file with python.

  • 1
    The term you are looking for is "cross section" gis.stackexchange.com/questions/30018/… without details this might be a duplicate question – risail Dec 27 '16 at 18:50
  • @risail and others - the two questions don't seem related at all to the uninformed (me!), could someone explain why this is a duplicate? – Simbamangu Dec 28 '16 at 6:47
  • It's a possible duplicate if the OP was more specific it may not be...but how to create a cross section in qgis is well documented here. More details are needed – risail Dec 28 '16 at 6:56
  • I do not think that could be a duplicate of cross section. I am uninformed, but I read the cross section question and it does not help me – Giacomo Dec 28 '16 at 22:07
  • Welcome to gis.stackexchange! Please note that a good question on this site is expected to show some degree of research on your part, i.e. what you have tried and - if applicable - code so far. For more info, you can check our faq. – underdark Dec 29 '16 at 0:59

I made a spatial join with [min,max] between the edges layer and the nodes layer so as to have the origin node as the minimum and the end node as the maximum

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.