use of com.graphhopper.routing.util.parsers.CountryParser in project graphhopper by graphhopper.
the class OSMReaderTest method testCurvedWayAlongBorder.
@Test
public void testCurvedWayAlongBorder() throws IOException {
// see https://discuss.graphhopper.com/t/country-of-way-is-wrong-on-road-near-border-with-curvature/6908/2
EncodingManager em = EncodingManager.start().add(new CarFlagEncoder()).add(new CountryParser()).build();
EnumEncodedValue<Country> countryEnc = em.getEnumEncodedValue(Country.KEY, Country.class);
GraphHopperStorage graph = new GraphBuilder(em).build();
OSMReader reader = new OSMReader(graph, new OSMReaderConfig());
reader.setCountryRuleFactory(new CountryRuleFactory());
reader.setAreaIndex(createCountryIndex());
reader.setFile(new File(getClass().getResource("test-osm12.xml").getFile()));
reader.readGraph();
assertEquals(1, graph.getEdges());
AllEdgesIterator iter = graph.getAllEdges();
iter.next();
assertEquals(Country.BGR, iter.get(countryEnc));
}
Aggregations