No I am talking about GraphHopper Reader For OpenStreetMap Data Dependency (https://mvnrepository.com/artifact/com.graphhopper/graphhopper-reader-osm) which is in v2.4, and not the core dependency. (and to be honest if someone could explain to me the differences between core and Reader For OpenstreetMap dependency, would be appreciated)
my old code to create an instance of graphhopper is the below :
@Bean
public GraphHopperOSM graphHopper() {
GraphHopperOSM graphHopper = ((GraphHopperOSM) new GraphHopperOSM().forServer());
String osmPath = "path to osm file";
graphHopper.setOSMFile(osmPath);
graphHopper.setGraphHopperLocation("path to osm file location");
graphHopper.setEncodingManager(new EncodingManager("car"));
graphHopper.setMinNetworkSize(200, 200);
graphHopper.importOrLoad();
return graphHopper;
}
After upgrading to 2.4 i get error for the current line :
Using 6.2 your code should look something like this:
GraphHopper graphHopper = new GraphHopper().init(
new GraphHopperConfig().
putObject("datareader.file", "path to osm file").
putObject("graph.location", "path to graphhopper folder (not osm file location!)").
putObject("prepare.min_network_size", 200). // skip this unless you know what you are doing, 200 is the default anyway
putObject("import.osm.ignored_highways", ""). // if you are only using car you can ignore paths, tracks etc. here, take a look at the documentation in `config-example.yml`
setProfiles(Arrays.asList(
new Profile("car").setVehicle("car").setWeighting("fastest")
))).
hopper.importOrLoad();