No snaps on raceway/test track

Hi, Trying to map match coordinates to a road that is part of a test track (classified as raceway, se screenshot from josm below) but I get no snaps from GH (v5.3) at all. I have tried looking at the profiles and encoders to find where these are filtered out but no luck. I am loading GH with a standard car profile. But I only get this error:

Sequence is broken for submitted track at time step 0. observation:Observation{point=57.7702467,12.7439825}, 0 candidates: [].

Anyone that knows how to resolve this?

Likely the raceways are not connected to the main road network, so they are filtered out by GraphHopper. Use prepare.min_network_size: 0 in your config.yml file to make sure all such ‘subnetworks’ are kept.

Thanks, I run GH in Java so I added this as a GraphhopperConfig value like this:

.putObject("prepare.min_network_size", "0")

Did not make a difference unfortunately. :frowning:

For debugging I also added a call directly to the locationIndex like this:

			LocationIndex index = graphHopper.getLocationIndex();
			Snap snap = index.findClosest(latitude, longitude, EdgeFilter.ALL_EDGES);
			EdgeIteratorState edge = snap.getClosestEdge();

The output shows indeed that all edges belonging to the “Skidpad” circuit are not in the graph.

It needs to be a number, not a String:

.putObject("prepare.min_network_size", 0);

You should also see the effects of this in the logs.

1 Like

You can also use the MVT layer to see such things (in the GH maps web app layers menu)

1 Like

When I tried this with the default prepare.min_network_size: 200 I could see that the raceway track we disabled (not hoverable) in the MVT layer. Then I set it to 0 as you proposed, but still the track was disabled.

Thanks a lot for all the help so far.

highway=raceway is probably not supported either. Which profile and which vehicle are you using? For example if you use ‘car’ I think you need to add raceway to the defaultSpeedMap in CarFlagEncoder (for 5.3)

1 Like

So that means I need to write a custom FlagEncoder with this addition (as documented in https://github.com/graphhopper/graphhopper/blob/master/docs/core/create-new-flagencoder.md)?

This did solve it, although the document is a bit outdated. Instead of injecting an EncodingManager I wrote a small FlagEncoderFactory and injected that.

graphHopper.setFlagEncoderFactory(new RacewayFlagEncoderFactory());

You can also try to use the ‘road’ vehicle and use the following custom_model:

{ "speed": [{
     "if": "true",
     "limit_to": "car_average_speed"
  ]}
}

Yes either create a new one or modify the existing one. Modifying the existing one will probably never really hurt, because I expect the raceways to be disconnected from the remaining network anyway.

Upgraded to GH 8.0 now and now this old trick does not work anymore, any hints on how I can enable highway=raceway to be routable in new GH versions?

Which trick did no longer work?

Implementing a custom flag decoder that includes raceway tracks.

GH 8 does no longer have flag encoders. Unless ‘raceway’ is listed in graph.ignored_highways these highways should be included by default.

I see, in my case they are not included in that list but still not accessible for routing in GHMaps or in my app.

I cannot get GH to route on any of the testtracks in the Hällered area in Sweden, for example: wayid=354003717

What is the configuration you are using?

In GHMaps I used the config-example.yml with one modification “prepare.min_network_size: 0”

config-example.yml only uses a single profile with the default car for which raceways are not accessible. If you do want to do it like this you need to add "raceway" to the list of highwayValues in CarAccessParser.java:

        highwayValues.addAll(Arrays.asList("motorway", "motorway_link", "trunk", "trunk_link",
                "primary", "primary_link", "secondary", "secondary_link", "tertiary", "tertiary_link",
                "unclassified", "residential", "living_street", "service", "road", "track", "raceway"));

To modify the speed as well you need to edit CarAverageSpeedParser.java accordingly, otherwise it will be 10km/h (the default for highway types that aren’t listed explicitly there).