Hi, i am having problems with the encoding manager as i get the following error message
2019-04-01 11:23:26,918 [main] INFO com.graphhopper.reader.osm.GraphHopperOSM - version 0.10.0|2018-03-02T07:40:33Z (5,14,4,3,3,2)
2019-04-01 11:23:26,925 [main] INFO com.graphhopper.reader.osm.GraphHopperOSM - graph foot|RAM_STORE|2D|NoExt|,,,,, details:edges:0(0MB), nodes:0(0MB), name:(0MB), geo:0(0MB), bounds:1.7976931348623157E308,-1.7976931348623157E308,1.7976931348623157E308,-1.7976931348623157E308
2019-04-01 11:23:26,969 [main] INFO com.graphhopper.reader.osm.GraphHopperOSM - start creating graph from /Users/pogunrek/Documents/GitHub/New/Data/berlin-latest.osm
2019-04-01 11:23:26,970 [main] INFO com.graphhopper.reader.osm.GraphHopperOSM - using foot|RAM_STORE|2D|NoExt|,,,,, memory:totalMB:256, usedMB:19
Exception in thread "main" java.lang.NoClassDefFoundError: com/graphhopper/routing/util/EncodingManager$AcceptWay
at com.graphhopper.reader.osm.OSMReader.filterWay(OSMReader.java:238)
at com.graphhopper.reader.osm.OSMReader.preProcess(OSMReader.java:166)
at com.graphhopper.reader.osm.OSMReader.readGraph(OSMReader.java:142)
at com.graphhopper.GraphHopper.importData(GraphHopper.java:693)
at com.graphhopper.GraphHopper.process(GraphHopper.java:662)
at com.graphhopper.GraphHopper.importOrLoad(GraphHopper.java:640)
at mapmatching.main(mapmatching.java:28)
Caused by: java.lang.ClassNotFoundException: com.graphhopper.routing.util.EncodingManager$AcceptWay
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 7 more
Process finished with exit code 1
while using the following jar file.
graphhopper-reader-osm-0.13.0.pre1.jar
I have also attached a snippet of my code below to help out in understanding what i may be doing wrong.
import com.graphhopper.GraphHopper;
import com.graphhopper.matching.*;
import com.graphhopper.reader.osm.GraphHopperOSM;
import com.graphhopper.routing.AlgorithmOptions;
import com.graphhopper.routing.util.EncodingManager;
import com.graphhopper.routing.util.FootFlagEncoder;
import com.graphhopper.routing.weighting.FastestWeighting;
import com.graphhopper.routing.weighting.Weighting;
import com.graphhopper.storage.GraphHopperStorage;
import com.graphhopper.storage.index.LocationIndexTree;
import com.graphhopper.util.GPXEntry;
import com.graphhopper.util.Parameters;
import java.util.List;
public class mapmatching {
public static void main(String[] args) {
//String osmFilePath = "/Data/berlin-latest.osm";
GraphHopperOSM hopperOSM = new GraphHopperOSM();
//hopperOSM.setDataReaderFile(osmFilePath);
hopperOSM.setOSMFile("/Data/berlin-latest.osm");
hopperOSM.setGraphHopperLocation("/Data/mapmatchingtest");
FootFlagEncoder encoder1 = new FootFlagEncoder();
hopperOSM.setEncodingManager(new EncodingManager(encoder1));
hopperOSM.getCHFactoryDecorator().setEnabled(false);
hopperOSM.importOrLoad();
GraphHopperStorage graph = hopperOSM.getGraphHopperStorage();
LocationIndexMatch locationIndex = new LocationIndexMatch(graph,
(LocationIndexTree) hopperOSM.getLocationIndex());
locationIndex.prepareIndex();
// create MapMatching object, can and should be shared accross threads
String algorithm = Parameters.Algorithms.DIJKSTRA_BI;
Weighting weighting = new FastestWeighting(encoder1);
AlgorithmOptions algoOptions = new AlgorithmOptions(algorithm, weighting);
MapMatching mapMatching = new MapMatching(hopperOSM, algoOptions);
// do the actual matching, get the GPX entries from a file or via stream
GPXFile gpxFile = new GPXFile();
gpxFile.doImport("/Data/30-Oct-2018-0944.gpx");
List<GPXEntry> inputGPXEntries = gpxFile.getEntries();
//List<GPXEntry> FILE3 = new GPXFile().doImport("/Data/30-Oct-2018-0944.gpx").getEntries();
MatchResult mr = mapMatching.doWork(inputGPXEntries);
// return GraphHopper edges with all associated GPX entries
List<EdgeMatch> matches = mr.getEdgeMatches();
// now do something with the edges like storing the edgeIds or doing fetchWayGeometry etc
matches.get(0).getEdgeState();
}
}
I will appreciate an idea unto how my problem can be fixed or areas i might be doing something wrong.
Thanks