I am getting a result that I don't understand and I am not sure if its my lack of understanding of OSM.

I am using the pgrouting functions pgr_drivingdistance to get the list nodes reachable within a certain time frame. This is my query:

create temp table prouting as select * from pgr_drivingdistance('select gid as id, source, target, traveltime_min as cost from ways', 3605, 5, false);

Travel time was calculated as follows:

sudo -u postgres psql -d planet -c "update ways set traveltime_min = length_m / 5000 * 60"

The contents of this table look as follows:

enter image description here

I wanted to now see a list of the nodes that attach to all source nodes of this graph but are not part of the result set of the pgr_drivingdistance function. I then paired these up with the costs of the result set in the prouting table. The idea was that I would now be able to have a cost traversing from the origin point up until the matching node.

select wi.gid,
       5 - agg_cost as rcost, 
       traveltime_min - (5 - agg_cost) as acost
from (
   select gid from ways wi join prouting pr on (wi.source = pr.node)
   select edge as gid from prouting) as sexclude 
join ways wi on (sexclude.gid = wi.gid) 
join prouting pr on (wi.source = pr.node);

rcost is the remaining cost that is left over when subtracting the agg_cost from the prescribed max cost (5) that was fed into pgr_drivingdistance. This gave me back the following result:

enter image description here

As you can see from the highlighted/underlined elements, those nodes should have been included in the original query as their cost when added to the value of the connected node falls within the cost limit I prescribed, 5.

Can anyone allude or give me a hint as to why these nodes are not included in my pgr_drivingdistance query.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.