I created a routing network based on OSM with OSM2PO in PostgreSQL with the extension pgrouting. I have got a column km
(distance in km), a column cost
(driving time) and max_speed
. I try to create a catchment with the function pgr_drivingDistance using the column km
(distance in km). This calculates a catchment with the shortest path, which is in most cases not a realistic distance for cars. Therefore I want to calculate the catchment based on the shortest driving time using cost
. But in the result, I need units of meters and not time. Many thanks for any hint.
Short version: I need a catchment with distances in km for the fastest (min time) route!
Here is the standard code for pgr_drivingDistance with shortest distance in km:
SELECT *
FROM routing_vertices_pgr
JOIN(
SELECT * FROM pgr_drivingDistance('
SELECT id,
source,
target,
km as cost
FROM routing',
1, 100, false)) AS route ON routing_vertices_pgr.id = route.node ;
You can't do such thing... In driving distance you're deciding what is your cost (time or distance or sth else) and function is processing this cost. Cost is only one... I think one of resolutions could be to count for distance, but exclude from edges this 'not realistic for cars' using clazz or flags field. You'll find descriptions of this fields in your osm2po config file.