Search in sources :

Example 1 with ElevationProvider

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));
}
Also used : ElevationProvider(com.graphhopper.reader.dem.ElevationProvider) GraphHopper(com.graphhopper.GraphHopper) File(java.io.File) GHPoint(com.graphhopper.util.shapes.GHPoint) SRTMProvider(com.graphhopper.reader.dem.SRTMProvider) Test(org.junit.Test)

Aggregations

GraphHopper (com.graphhopper.GraphHopper)1 ElevationProvider (com.graphhopper.reader.dem.ElevationProvider)1 SRTMProvider (com.graphhopper.reader.dem.SRTMProvider)1 GHPoint (com.graphhopper.util.shapes.GHPoint)1 File (java.io.File)1 Test (org.junit.Test)1