use of com.graphhopper.reader.dem.ElevationProvider in project graphhopper by graphhopper.
the class OSMReaderTest method testReadEleFromDataProvider.
@Test
public void testReadEleFromDataProvider() {
GraphHopper hopper = new GraphHopperFacade("test-osm5.xml");
// get N10E046.hgt.zip
ElevationProvider provider = new SRTMProvider();
provider.setCacheDir(new File(GraphHopperIT.DIR));
hopper.setElevationProvider(provider);
hopper.importOrLoad();
Graph graph = hopper.getGraphHopperStorage();
int n10 = AbstractGraphStorageTester.getIdOf(graph, 49.501);
int n30 = AbstractGraphStorageTester.getIdOf(graph, 49.5011);
int n50 = AbstractGraphStorageTester.getIdOf(graph, 49.5001);
EdgeIteratorState edge = GHUtility.getEdge(graph, n50, n30);
assertEquals(Helper.createPointList3D(49.5001, 11.501, 426, 49.5002, 11.5015, 441, 49.5011, 11.502, 410.0), edge.fetchWayGeometry(3));
edge = GHUtility.getEdge(graph, n10, n50);
assertEquals(Helper.createPointList3D(49.501, 11.5001, 383.0, 49.5001, 11.501, 426.0), edge.fetchWayGeometry(3));
}
Aggregations