简体   繁体   English

pgr_drivingDistance,每条路线上的距离值灵活

[英]pgr_drivingDistance with flexible distance value on each route

I would like to calculate a graph similiar to an isochrone using pgsql. 我想使用pgsql计算与等时线相似的图。 Therefore, I already used the algorithm pgr_drivingDistance . 因此,我已经使用了算法pgr_drivingDistance You provide a starting point and a distance value and receives an isochrone. 您提供起点和距离值并接收等时线。

The output using the algorithm is received with code which looks something like: 使用该算法的输出通过以下代码接收:

SELECT * FROM pgr_drivingDistance(
        'SELECT id, source, target, cost FROM edge_table',
        2, 2, false -- starting point, distance, directed
      );

The red star represents the starting point. 红星代表起点。

Now, I want a graph which works the same way, like starting at one point and get routes in all directions. 现在,我想要一个工作原理相同的图形,例如从一个点开始并获得所有方向的路线。 The difference is, that I don't want to provide a travel distance, but a list with point coordinates, which are lying on the road network. 所不同的是,我不想提供行进距离,而是要提供道路网络上包含点坐标的列表。 The route in every direction has to stop at the first reached point lying on each route. 各个方向上的路线都必须在每个路线上的第一个到达点处停止。 The distance on every route is different and I don't know which points are the closest ones. 每条路线上的距离都不同,我不知道哪个点是最近的。

The desired output using the "stopping" points, which are visualized in green, is supposed to look like this. 使用“停止”点(绿色显示)的所需输出应该看起来像这样。

I tried already: 我已经尝试过了:

  • Using the given algorithm pgr_drivingDistance and raising the distance value every time no point is reached -> problem here: the distance is equal for all directions and not individual for each route. 使用给定的算法pgr_drivingDistance并在每次未到达任何点时提高距离值->这里的问题是:所有方向的距离相等,而不是每个路线的距离。
  • Using the algorithm pgr_dijkstra for each route -> problem here: because you don't know which point is affected you don't know which end point to choose for the calculation. 在每条路径上使用算法pgr_dijkstra- >这里的问题:因为您不知道受影响的点,所以也不知道选择哪个端点进行计算。 You also cannot take the closest one in the immediate vicinity because you need the closest one on the specific route. 您也不能在附近采取最接近的路线,因为您需要在特定路线上最接近的路线。

I know that I have to build an almost complete new algorithm, but maybe someone has an idea how to start or even experience with this kind of problem. 我知道我必须构建一个几乎完整的新算法,但也许有人对如何开始甚至是解决此类问题有一个想法。

Thank you in advance! 先感谢您!

This is a one to many routing problem. 这是一对多的路由问题。 You have to compute the route to each end point to find the shortest one. 您必须计算到达每个端点的路线以找到最短的路线。 I have not looked at the pgRouting function recently, but I believe there is a one to many, many to one and many to many Dijkstra function(s). 我最近没有看过pgRouting函数,但我相信这里有一个一对多,多对一和多对多的Dijkstra函数。 You should be able to use the one to many to compute all the routs in one go and then you can sort the routs based on length to find the shortest one. 您应该能够使用一对多计算一次的所有溃败,然后可以根据长度对溃败进行排序以找到最短的溃败。

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

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