0

I'm new to pgRouting and I want to implement a pedestrian routing system. I've already implemented a routing system using pgRouting, PostGIS, GeoServer, OSM data and OpenLayers 3 and it uses Dijkstra to find the routes.

My problem is I don't know how to specify that the routing I want my system to do is for pedestrians.

3
  • we're using distance and a sidewalk layer for our pedestrian routing ... so it's all about distance rather than time Sep 28, 2015 at 15:00
  • Hi! I'm sorry I'm new in this kind of stuff. How can I use a sidewalk layer for my routing? Sep 28, 2015 at 15:09
  • 1
    Well first - do you have sidewalk data? Otherwise, you'll have to make some assumptions about your street data using speed limits, etc. to figure out if someone would/could walk on it... Sep 28, 2015 at 15:38

1 Answer 1

2

The first thing is to get proper data - assuming that in OSM there is some you have to create a network from it. I'm using osm2po which is producing graph with info about assignation of road-types. You can configure it in config file.

wtr.tag.highway.living_street =  1, 63, 7,   car|bike|foot
wtr.tag.highway.pedestrian =     1, 62, 5,   bike|foot
wtr.tag.highway.track =          1, 71, 10,  bike|foot
wtr.tag.highway.path =           1, 72, 10,  bike|foot
wtr.tag.highway.cycleway =       1, 81, 15,  bike
wtr.tag.highway.footway =        1, 91, 5,   foot
wtr.tag.highway.steps =          1, 92, 5,   foot

Osm2po produces SQL script you can import into database via psql -f, then in your routing function you can use flags column to select for routing input only edges assignated for pedestrians (third bit of flags set to 1)

SELECT
    sum(pgr.km) AS km, sum(pgr.cost) AS cost, ST_Union(pgr.geom_way) AS geom 
FROM 
    pgr_poland pgr, 
    (SELECT * FROM pgr_astar('select id, source,target, cost, reverse_cost, x1, y1, x2, y2 from pgr_poland where flags::bit(3) & B''100'' = B''100'' ', <<start_edge_i>>, <<stop_edge_i>>, true, true)) AS rte  
WHERE 
    pgr.id = rte.id2;

Of course following @mapBaker it is wiser to use distance as a cost than time.

0

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.