GraphHopper.com | Forum | GitHub | Maps | Blog

Start/end a route on overpass/underpass rather than the highway


#1

I wonder if there is any setting that can avoid a route to start/end on a highway when there is a overpass/underpass. I bumped into the issue that when I am using GPS coordinates to do offline routing, there are cases that the coordinates are identified on the highway rather than the overpass/underpass road. Here is an example from GraphHopper:
https://graphhopper.com/maps/?point=30.216%2C-97.744&point=30.215%2C-97.749&locale=en-US&vehicle=car&weighting=fastest&elevation=true&use_miles=false&layer=Omniscale
And same origin/destination using Google Map:
https://www.google.com/maps/dir/‘30.216,-97.744’/‘30.215,-97.749’/@30.2145777,-97.7495444,17z/data=!3m1!4b1!4m10!4m9!1m3!2m2!1d-97.744!2d30.216!1m3!2m2!1d-97.749!2d30.215!3e0

As I am actually using GraphHopper-Core and doing offline routing on a desktop, I wonder if there is any setting for preventing a route to star or end on a highway. Thanks!


#2

This is currently not possible. I recommend to have a look into our map matching module for this use case


#3

If I only want to identify which routes that start/end on highway, is there a way to retrieve road type or at least speed from the result of routing or do I need to do map matching still? (And if this is the case, does the map matching always return the same road type as identified by routing engine?)


#4

You can determine the average_speed via path details, yes. Soonish with #1447 it is possible to fetch highway type and more from an edge.

I need to do map matching still

I thought you are doing navigation and then you could previous GPS locations and feed this into map matching for a more stable result even if the start point is kind of ambiguous.

(And if this is the case, does the map matching always return the same road type as identified by routing engine?)

They use the same underlying data, yes


#5

Look forward to having highway type via path details.

Just want to add context here: I was tying to skip map matching as I only need to estimate driving distances from a large dataset. In this case, I don’t really care about detailed navigation information, but the misinterpret between overpass and highway of a starting point would miscalculate the driving distance (form the example in my original post, it can be 3-4 times longer). As I am trying to reduce computational cost as much as possible with the large amount of trips I have, I was hoping to simply get some indicator that has already included by Routing and “flag” those potentially miscalculated trips.


#6

I am having trouble figuring out how to pull AVERAGE_SPEED from path details with graphhopper-core (0.10.0) in Java, cannot find much explanation in the Java library itself.

My guess is that the request should have:

request.setPathDetails(List pathDetails)

But I am not sure what information should be provided in the pathDetails list here to get average speed.

path.getPathDetails()

As it returns Map<String, List>, I have to know the key String here and probably need to setup the PathDetail list properly in the request.

Hope if anyone has done it can give me some help here. Thanks!


#7

That should be indeed better explained.

The map contains a list of intervals for every path detail for which a certain value is valid. E.g. if you request street_name you get the following map

"street_name" => [PathDetail{first=0,last=1,value=Rue Principale}, 
                  PathDetail{first=1,last=13,value=Rue Albatros}, 
                  PathDetail{first=13,last=18,value=D19}, ... ]

I.e. the road Rue Principale goes from point index 0 until 1, then comes road “Rue Albatros” until 13, then road D19 until index 18 and so on. And “point index” refers to the PointList returned by getPoints. Is this more clear?


#8

Thank you very much for the explanation, this is very helpful.

A follow up question on the average_speed from PathDetail. My routes are in United States, and I found average_speed from PathDetails is like 50, 55, 60, 65 etc. My understanding is that it is in the unit of kph, and speed unit in the US is in mph. So if a road is 55 mph=88.51 kph, does that mean I will get 90 kph or 85 kph from average_speed?


#9

We always use kph.