[OSRM-talk] Shortest path post-processing

Patrick Niklaus patrick.niklaus at student.kit.edu
Mon Dec 14 15:29:45 UTC 2015


Hey Franics!


the naming is a little bit unfortunate in that code path. I started
refactoring this a little bit but got caught up in other tasks. What
UnpackPath() actually does it to unpack (remove shortcut edges) _and_
decompress (translate it to a geometry). That means the node ids you
get back don't fit into the edge-based-graph that is used in facade.

What I would suggest in this case is to take a look at the
alternative_path.hpp file. The alternative search needs to to
something similar (unpack paths to do post-processing).[1] You can
basically copy that code and unpack the path yourself. The resulting
path will work for `facade` (as you can see a few lines lower)

[1] https://github.com/Project-OSRM/osrm-backend/blob/5a9bee052753ab6c978e60ac2ca331f2ed378aa8/routing_algorithms/alternative_path.hpp#L433
[2] https://github.com/Project-OSRM/osrm-backend/blob/5a9bee052753ab6c978e60ac2ca331f2ed378aa8/routing_algorithms/alternative_path.hpp#L469

Hope this helps.

Cheers,
Patrick

On Sun, Dec 13, 2015 at 10:05 PM, Francis Giraldeau
<francis.giraldeau at gmail.com> wrote:
> Hello!
>
> I would like to do some post-processing on the resulting shortest path using
> edges from the graph. In ViaRoutePlugin, I tried to iterate on the
> raw_route.unpacked_path_segments, but the BeginEdges(node) and
> EndEdges(node) returns an empty range as if the a segment is not connected
> to the next.
>
> for (std::vector<PathData> data: raw_route.unpacked_path_segments) {
>
>     std::cout << "DEBUG FOR EACH NODE:" << std::endl;
>
>     for (int i = 0; i < data.size(); i++) {
>
>         PathData path = data[i];
>
>         std::cout << "[" << facade->BeginEdges(path.node) << ", " <<
>
>                      facade->EndEdges(path.node) << "]" << std::endl;
>
>         for (const auto edge : facade->GetAdjacentEdgeRange(path.node)) {
>
>             std::cout << edge << std::endl;
>
>         }
>
>     }
>
> }
>
>
> What would be the right way to iterate on segments and access the EdgeData?
>
>
> Thanks!
>
>
> Francis Giraldeau
>
>
> _______________________________________________
> OSRM-talk mailing list
> OSRM-talk at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/osrm-talk
>



More information about the OSRM-talk mailing list