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.
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:
x_at(0),y_at(0),x_at(1),y_at(1)
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.