I am new to GraphHopper and trying to get it set up to run in Eclipse. I follow the instructions on the github and have the following code:
> import java.util.Locale;
> import com.graphhopper.GHRequest;
> import com.graphhopper.GHResponse;
> import com.graphhopper.GraphHopper;
> import com.graphhopper.PathWrapper;
> import com.graphhopper.routing.util.EncodingManager;
> import com.graphhopper.util.Instruction;
> import com.graphhopper.util.InstructionList;
> import com.graphhopper.util.PointList;
> import com.graphhopper.reader.osm.GraphHopperOSM;
> public class test3 {
>
> public static void main(String[] args) {
> //create one GraphHopper instance
> GraphHopper hopper = new GraphHopper().forDesktop();
> hopper.setOSMFile("\\Users\\mlevy36\\Desktop\\sf-bay-area.osm.bz2");
> //where to store graphhopper files?
> hopper.setGraphHopperLocation("C:\\Users\\mlevy36\\Desktop");
> hopper.setEncodingManager(new EncodingManager("car"));
>
> //now this can take minutes if it imports or a few seconds for loading
> //of course this is dependent on the area you import
> hopper.importOrLoad();
>
> //simple configuration of the request object, see the GraphHopperServlet classs for more possibilities.
> GHRequest req = new GHRequest(37.8, -122.314, 38, -122).
> setWeighting("fastest").
> setVehicle("car").
> setLocale(Locale.US);
> GHResponse rsp = hopper.route(req);
>
> //first check for errors
> if(rsp.hasErrors()) {
> // handle them!
> // rsp.getErrors()
> return;
> }
>
> //use the best path, see the GHResponse class for more possibilities.
> PathWrapper path = rsp.getBest();
>
> //points, distance in meters and time in millis of the full path
> PointList pointList = path.getPoints();
> double distance = path.getDistance();
> long timeInMs = path.getTime();
>
> InstructionList il = path.getInstructions();
> //iterate over every turn instruction
> for(Instruction instruction : il) {
> instruction.getDistance();
> }
> }
> }
However, I am thrown the error “The method setOSMFile(String) is undefined for the type GraphHopper”. What do I need to do differently? Why is this method missing?