2

My setup for my web page is OpenLayers, Postgresql/postgis and pgrouting.

What I do not understand is how I am going to do the routing.I have read many tutorials but I don't understand what my next step will be.

So I have downloaded an shp file of osm data into my computer and imported the 'roads.shp' into my database. In the database, I have also all of my bus route stops as tables of points.

How do I use pgrouting from now on? What algorithm to use and how to create the topology? Do I need to merge the roads shp with the tables of the bus route stops ?

For additional info please don't hesitate to ask!

1 Answer 1

2

Have you done the pgRouting workshop?

The workshop should clarify the following:

  • There are import tools for OSM data, so the network will contain the routing topology already after import.
  • If you still want to use SHP files, then it explains how.

Your bus stops have coordinates, so you just need to start from the nearest point in your road network. Because bus stops are probably not going to change, you could also make your bus stops nodes in your road network. It will be more work at first, but routing queries will become a lot easier as you can then route directly from bus stop node to bus stop node.

4
  • hello, i was expecting that you would answer sooner or later. Well I have imported all shp fiels into my database, both the bus route stops and the roads.shp from osm data. I know how to use pgrouting's algorithm and and how to create network topology. What I don't understand is how the bus stops will be combined with the road shp so that when I visualize my result the node will be connected through the road? Do I need to connect the road network with the bus stops somehow?
    – drizo
    Commented Nov 6, 2014 at 18:23
  • Well, I would say that a bus stop is always on some street. So I would pre-process the data and split the road links where the bus stops are. So where you have one road link before you will have 2 road links afterwards. Just use a new serial ID attribute, then you can keep the old ID as well for both segments. When you run the topology function again using the new ID column, then all your stop points are nodes in the routing network.
    – dkastl
    Commented Nov 7, 2014 at 1:17
  • mr daniel, excuse me for a moment I am pretty new to this. I have a layer in my database which contains the bus stops as geometry points.I try to use pgr_djikstra on that table-layer without snapping it on a road and it will tell me that the source and target columns have "null" values .. I think I can to the job without snapping the points on the road network but pgr_craetetopology won't work on my tables. What could be wrong?
    – drizo
    Commented Nov 7, 2014 at 9:03
  • I created a new question so I could make clearer what I ask and get an answer closer to what I want. Please check it out! thanks! bit.ly/1x9iUqJ
    – drizo
    Commented Nov 7, 2014 at 16:06

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.