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.

Powered by Discourse