1

I created a map of LineStrings using QGis and then it was exported to a Postgis DB, then I used the query below in order to create the vertexes in the map so it could be used with the functions of PgRouting.

select pgr_createTopology('ways', 0.00000001, 'geom', 'gid');

The following map is the result of above procedure.

QGis Layer imported from a PostgreSQL DB

How can I add more vertexes in the LineStrings?

  • Vertices are the nodes of the graph, basically start and end points of the linestrings docs.pgrouting.org/2.0/en/src/common/doc/functions/…. For me the graph looks good and routable. – user30184 Jun 5 '16 at 20:46
  • Yes, it is routable but I need add more Vertices because I need them in specific places. – figuedmundo Jun 5 '16 at 21:29
  • So you want to add more nodes and edges? What defines them (e.g. what source data do you have)? Are the new nodes all located along the existing edges? – BradHards Jun 5 '16 at 21:55
  • I only want to add nodes, I have a shapefile as a source data, and yes I want the new nodes along the existing edges. – figuedmundo Jun 5 '16 at 22:11
  • In graph edge has nodes at both ends but not in the middle. You must cut your edges by splitting the linestrings in your shapefile. – user30184 Jun 6 '16 at 4:28
2

From the toolbox use the "Densify Geometries Given An Interval" tool and specify how far apart in map coordinates you want your extra vertices:

enter image description here

Note that my lines aren't exact multiples of the distance so you get some closer points (see bottom right).

The other "Densify Geometries" tool adds a fixed number of verts regardless of the length of the line feature. So, for example, each line gets 10 new points between its vertices, even if its a 10m line or a 1000m line.

Hopefully one of these will do you.

Actually hmmm - your lines already have more points than just the vertices and your graph is not showing them as nodes - its deleting all order-2 graph nodes and only keeping order-3 (and order-1) nodes. You may have to split each line into features at the nodes. You can do this with the "Explode Lines" tool.

If, after that, your graph still has no order-2 nodes then you'll need a different approach, which might be to snap your source point to the line geometry, do the routing by the nodes of the segment its snapped to, and then interpolate along the line segment.

  • Could you please explain what are the order-1-2-3 graph nodes? – figuedmundo Jun 6 '16 at 15:17
  • 1
    "order" is the number of edges that meet at a node. So an order-1 node is the end of the line, an order-3 node is a T-junction, order-4 is a X. An order-2 node a straight-through --0-- and its only purpose in routing is to provide breaks in routes where perhaps speed limits change or pickup points are. I guess you need more of these. if you explode the line and create a new feature every 100m or so, does the topology builder drop those too? – Spacedman Jun 6 '16 at 15:37

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.