简体   繁体   English

使用pgr_drivingDistance获取最快路径的距离

[英]Get distance of fastest path with pgr_drivingDistance

I created a routing network based on OSM with OSM2PO in PostgreSQL with the extension pgrouting. 我在PostgreSQL中使用扩展名pgrouting创建了基于OSM和OSM2PO的路由网络。 I have got a column km (distance in km), a column cost (driving time) and max_speed . 我有一个列km (以km为单位的距离),一个列cost (行车时间)和max_speed I try to create a catchment with the function pgr_drivingDistance using the column km (distance in km). 我尝试使用km (距离以km为单位)列使用函数pgr_drivingDistance创建一个集水区。 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 . 因此,我想基于使用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: 这是pgr_drivingDistance的标准代码,其最短距离以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 ;

If you have the feature type (highway, primary rd), creating a column with max_speed and dividing this max_speed into the distance will give you the time it takes to travel the road segment. 如果您具有要素类型(高速公路,主要道路),则创建具有max_speed的列并将该max_speed划分为距离,将为您提供路段行驶所需的时间。 This time can be selected as cost to give the shortest driving distance. 可以选择这段时间作为成本,以提供最短的行驶距离。

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. 成本只是一个...我认为解决方案之一可能是计算距离,但要使用clazz或flags字段排除这种“对汽车不现实”的边缘。 You'll find descriptions of this fields in your osm2po config file. 您可以在osm2po配置文件中找到此字段的描述。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM