I'm developing an application that needs routing information for certain cities. First, I downloaded a openstreetmap datafile (*.osm) and then I imported it into a PostgreSQL database using osm2pgrouting tool (http://workshop.pgrouting.org/chapters/installation.html). After this, I have the following tables:

  • nodes: that contains simple locations points
  • ways: that contains ways with some nodes involved
  • vertices_tmp: stores nodes that may be used for pgrouting funtcions like Djistra, A*...etc.

Would I use nodes that isn't in "vertices_tmp" table for calculate distances between nodes? Or I would only do it with the nodes stored in "vertices_tmp"?

Into ways table there are a field named "the_geom" that encapsulates different locations points (nodes). For example:

"MULTILINESTRING((1.5897786 42.5600441,1.5898376 42.5601455,1.589992 42.5605438,1.590095 42.5606795,1.5901782 42.5608026,1.5902238 42.561018,1.5902912 42.5616808,1.5903685 42.561899,1.5904008 42.5620563,1.5903836 42.5624117,1.5904265 42.5627151,1.5904947 42.5628368,1.5905981 42.5629553,1.5906926 42.5631007,1.590802 42.5633238,1.5908604 42.5634883,1.5909501 42.5637139,1.5910869 42.5638755,1.5913053 42.5639639,1.5914994 42.5640237,1.591648 42.5640261,1.5919232 42.5640145,1.5921124 42.5640363,1.5923292 42.5640953,1.592804 42.5643306))"

Can I route with intermediate nodes or only with source/target nodes?

My goal is to be able to routing betweent differents nodes or POIs, depending of its amenity tags, not only driving distance, walking distance too. Furthermore I need to calculate shortest path for source/targets nodes.

Any idea for do this?

1 Answer 1


For your routing topology the only "nodes" (or "vertices"), that matter, are the ones used in source and target column of your network table. vertices_tmp can be handy, but it's not required.

In general pgRouting functions take node ID's (you find all of them in vertices_tmp) as arguments, so using a point between source and target vertex is not possible with the "core" functions.

However, there is a number of "withPoints" functions, which exactly provide this extended functionality, see detailed explanation in https://docs.pgrouting.org/latest/en/withPoints-family.html#withpoints

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.