Road or street type of matched road segments

Hi,
I want to identify road type (highway or a street for e.g.) of the matched road segments. I see that there is a tag called “way” in the .osm files which has the information I want. How can I go on from the output of the graphhopper map matching module to identify the type of road segments that are matched?

Thanks,
Abhishek.

This is currently not possible via the JSON web API, but you could use the DataFlagEncoder to collect this data via Java API. But it means more work and work in Java :wink:

Thanks for the prompt reply. I will try that.

Hi,

I was trying to use the DataFlagEncoder, instead of using CarFlagEncoder, as you suggested to retrieve road type from matched edges. However when I instantiate the MapMatching class I get “RuntimeExepcetion: do not call getMaxSpeed”.

I’ve had a look at the code of the DataFlagEncoder and this method is not supposed to be called. I’ve also seen there is a getMaxPossibleSpeed which should work. The call comes from FastestWeighting.

Should we use another weighting method instead in order to use the DataFlagEncoder? In this case, which one should I use?

By the way, how can I ensure only car routes are enabled when I use the more generic DataFlagEncoder? Should I implement my own CarFlagEncoder subclass to store the route info myself?

Thanks.

Good questions. Either we should use a specific configured Weighting (like GenericWeighting) which uses the encoder correctly and also correctly regarding the vehicle type or we use a separate Weighting like CarWeighting.

By the way, how can I ensure only car routes are enabled when I use the more generic DataFlagEncoder?

The goal is to do that by per-import or per-query configuration. Also the current defaults are to use car routes only. See this issue