Netbeans (Maven) - Including elevation data in routing

Hiya, I’ve had a look around to see how to incorporate elevation data into my routing but am still unsure of how to do it.

I’m presuming that I have to apply the Elevation at the moment I create the graph files?

GraphHopper graphHopper = new GraphHopper().setGraphHopperLocation(LocationGrapphopperFiles) 
                .setEncodingManager(new EncodingManager("car"))
                .setOSMFile(LocationRoutingFile)
                .setElevationProvider(ElevationProvider.NOOP)
                .forDesktop();

graphHopper.importOrLoad();

Do I then have to tell it to use elevation data when routing?

GHRequest request = new GHRequest().setWeighting("fastest").setVehicle("car");
GHResponse route = graphHopper.route(request); // Do I have to specify to use elevation data?

At the moment I get the same result no matter what I do.

The other question I have is if I should care where the cache_dir is set? It is only used on initial creation of the graph right?

Can you try a different provider than “no operation” :slight_smile: ?

Thanks,

NOOP was the default so presumed that the default was what was needed after enabling :slight_smile:

.setElevation(true)
.setElevationProvider(new CGIARProvider().setCacheDir(new File(Directory)))

From there is there a method to output elevations between points? Eg. Point 1 -> Point 2 is 100m and +10m elevation?

for(Instruction instruction : il) {
System.out.println(instruction.getDistance() + " Meters");
}

In the Documentation - https://github.com/graphhopper/graphhopper/blob/master/docs/core/elevation.md
http://droppr.org/srtm/v4.1/6_5x5_TIFs - Site is no longer available and is a holding domain for ads.
http://srtm.csi.cgiar.org/srtmdata/ - This is a more reliable link to provide in my opinion.

This is starting to turn into another question from the original question. So I will start a new thread asking about elevation PointList -> InstructionList.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

Powered by Discourse