PointList Sampling

Hello,

I’m using GraphHopper for a simulation and I would like to sample a route. I can calculate the route between start and end and get the Point- and Instructionlist. Is it possible that I get a Pointliste which is sampled in e.g. 5m distances and the unique edge id of the point?

In general I’m working with cells on my simulation and I would like to sample the graph edge with 5x5m cells (it is enough to get a GPS coordinate in the cell middle, which is the road).

Thanks a lot

You can use the edge_id path detail which gives you the edge id in exact precision. See here a post about path details: Routing API: Using Path Details - GraphHopper Directions API

My objects does not have got the dge_id, I’m using Java with GraphHopper 9.0-pre1 and this is my code excerpt, and the ? should be the edge ID

        final ResponsePath l_path = l_response.getBest();
        final InstructionList l_instructions = l_path.getInstructions();

        final List<EdgePoint> l_points = new ArrayList<>();
        for ( final Instruction l_edge : l_instructions )
            if ( l_edge.getSign() != 4 && l_edge.getSign() != 5 )
                for ( final GHPoint3D l_point : l_edge.getPoints() )
                    l_points.add( new EdgePoint( l_point.lat, l_point.lon, ? ) );

You will have to enable the path details in the request:

request.setPathDetails(Arrays.asList("edge_id"));

After that it will be available under:

responsePath.getPathDetails().get("edge_id");

I think the edge is the OSM id, is this correct? How can I query the GPS data of an edge or map the points in the given pointlist in relation to my edge?

edge is the OSM id

No. An OSM way can have multiple edges. But you can store the OSM way ID per edge.

How can I query the GPS data

You mean the geometry?

Yes I would like to resample the geometry? I think this is a line with a gps start- and endpoint?
My goal is to sample the edge in e.g. 4m distance steps