3

I would like to use one of pgrouting's algorithm to find the (shortest) path between 2 points with predominance for a specific type of road.

To build the data I used the osm2pgrouting.

Is there an algorithm where I could define my preferences for the road type (in table ways class_id column class_id which represents road type or in table osm_way_types)? If not how should I tweak my database? Knowing that I used the osm2pgrouting --> there is table public.osm_way_classes there is max_speed but it seems poor choice for tweaking it. I would like to leave it alone. I didn't really find anything useful in other tables. Any ideas?

@edit (second question deleted) I saw that in dijkstra algorithm there is cost in inside query. Maybe add column priority to way_classes (or way_types). And then join the table ways with table way_classes and then with table way_types. So in query there won't be ST_Length / length in cost but length * priority. What do you think?

4
  • Welcome to Geographic Information Systems. Please visit the tour to learn about our focused Q/A standards. Please limit your post to one question per question. You can edit your question to make it more specific.
    – Fezter
    Commented May 22, 2017 at 23:10
  • 1
    It's not a bad question. Remove b and I will vote to reopen and attempt an answer Commented May 23, 2017 at 7:31
  • @JohnPowellakaBarça done :-) Commented May 23, 2017 at 14:51
  • Voted to reopen. Think it needs five of us to do so. +2 so far Commented May 23, 2017 at 15:37

1 Answer 1

1

All pgRouting shortest path functions can do what you want to do. "Shortest" in pgRouting means minimum cost, which every pgRouting function allows you to define.

I recommend you the pgRouting workshop, which explains in chapter Advanced Routing Queries, how to change the cost attribute.

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.