use of com.graphhopper.matching.MatchResult in project graphhopper by graphhopper.
the class MapMatchingTest method testSmallSeparatedSearchDistance.
/**
* This test is to check what happens when two GPX entries are on one edge
* which is longer than 'separatedSearchDistance' - which is always 66m. GPX
* input:
* https://graphhopper.com/maps/?point=51.359723%2C12.360108&point=51.358748%2C12.358798&point=51.358001%2C12.357597&point=51.358709%2C12.356511&layer=Lyrk
*/
@ParameterizedTest
@ArgumentsSource(FixtureProvider.class)
public void testSmallSeparatedSearchDistance(PMap hints) throws IOException {
Gpx gpx = xmlMapper.readValue(getClass().getResourceAsStream("/tour3-with-long-edge.gpx"), Gpx.class);
MapMatching mapMatching = new MapMatching(graphHopper, hints);
mapMatching.setMeasurementErrorSigma(20);
MatchResult mr = mapMatching.match(GpxConversions.getEntries(gpx.trk.get(0)));
assertEquals(Arrays.asList("Weinligstraße", "Fechnerstraße"), fetchStreets(mr.getEdgeMatches()));
// TODO: this should be around 300m according to Google ... need to check
assertEquals(mr.getGpxEntriesLength(), mr.getMatchLength(), 11);
}
use of com.graphhopper.matching.MatchResult in project graphhopper by graphhopper.
the class MapMatchingTest method testLoop2.
/**
* This test is to check that loops are maintained. GPX input:
* https://graphhopper.com/maps/?point=51.342439%2C12.361615&point=51.343719%2C12.362784&point=51.343933%2C12.361781&point=51.342325%2C12.362607&layer=Lyrk
*/
@ParameterizedTest
@ArgumentsSource(FixtureProvider.class)
public void testLoop2(PMap hints) throws IOException {
MapMatching mapMatching = new MapMatching(graphHopper, hints);
// TODO smaller sigma like 40m leads to U-turn at Tschaikowskistraße
mapMatching.setMeasurementErrorSigma(50);
Gpx gpx = xmlMapper.readValue(getClass().getResourceAsStream("/tour-with-loop.gpx"), Gpx.class);
MatchResult mr = mapMatching.match(GpxConversions.getEntries(gpx.trk.get(0)));
assertEquals(Arrays.asList("Jahnallee, B 87, B 181", "Funkenburgstraße", "Gustav-Adolf-Straße", "Tschaikowskistraße", "Jahnallee, B 87, B 181", "Lessingstraße"), fetchStreets(mr.getEdgeMatches()));
}
Aggregations