Comments (4)
Thanks! This is indeed wrong - I've updated it to your code.
And you seem to try to use the map matching with hopper.setCHEnabled(true)
where you would need to call graph.getBaseGraph before passing to the constructors. Currently a graph with enabled CH is not 'officially' supported and therefor not recommended.
from map-matching.
I have the same problem and it is not resolved.
When I use:
GraphStorage graph = hopper.getGraph();
//LocationIndexMatch locationIndex = new LocationIndexMatch(graph, new LocationIndexTree(hopper.getGraph(), new RAMDirectory()));
LocationIndexMatch locationIndex = new LocationIndexMatch(graph, new RAMDirectory());
locationIndex.prepareIndex();
MapMatching mapMatching = new MapMatching(graph, locationIndex, encoder);
I get compilation error:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The constructor LocationIndexMatch(GraphStorage, RAMDirectory) is undefined
When I tried with:
LocationIndexMatch locationIndex = new LocationIndexMatch(graph, new LocationIndexTree(hopper.getGraph(), new RAMDirectory()));
I get this error:
Exception in thread "main" java.lang.IllegalThreadStateException: already created
at com.graphhopper.storage.RAMDataAccess.create(RAMDataAccess.java:86)
at com.graphhopper.storage.RAMDataAccess.create(RAMDataAccess.java:33)
at com.graphhopper.storage.index.LocationIndexTree.prepareIndex(LocationIndexTree.java:319)
....
This is my full code block copied form README.md
private void start( String[] args )
{
GraphHopper hopper = new GraphHopper().
// disableCHShortcuts().
setEncodingManager(new EncodingManager("CAR")).
setGraphHopperLocation("graphhopper-out-folder2/").
setOSMFile("/Users/karim/Documents/workspace-other/mapmatching/src/main/java/com/eta/resources/india-latest.osm");
CarFlagEncoder encoder = new CarFlagEncoder();
hopper.setCHEnable(false);
hopper.importOrLoad();
// create MapMatching object, can and should be shared accross threads
GraphStorage graph = hopper.getGraph();
LocationIndexMatch locationIndex = new LocationIndexMatch(graph, new LocationIndexTree(hopper.getGraph(), new RAMDirectory()));
//LocationIndexMatch locationIndex = new LocationIndexMatch(graph, new RAMDirectory());
locationIndex.prepareIndex();
MapMatching mapMatching = new MapMatching(graph, locationIndex, encoder);
// do the actual matching, get the GPX entries from a file or via stream
List<GPXEntry> inputGPXEntries = getList();
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
for (Iterator iterator = matches.iterator(); iterator.hasNext();) {
EdgeMatch edgeMatch = (EdgeMatch) iterator.next();
System.out.println(edgeMatch.getEdgeState());
}
}
from map-matching.
The readme is updated to reflect this change. For future reference look also into the unit tests.
from map-matching.
Thanks a lot :)
from map-matching.
Related Issues (20)
- how i make the .pbf file by myself, i want to test another file, but my file format is .shp, any way to convert the format? Please help HOT 1
- Input Gpx file format HOT 1
- Unexpected Matching Behavior HOT 3
- map matching NPE HOT 1
- "Sequence is broken for submitted track at time step" error when matching a GPX that should be matchable
- Problem with Ineffective
- Encoder for car not found. Existing: foot| HOT 6
- Error saving matching large gpx. HOT 3
- Sequence is broken for submitted track HOT 4
- How to get transition probabilities ?
- Matching performance is very low。What should I do? HOT 1
- How to avoid unnecessary u-turns HOT 1
- Divide measurementErrorSigma into its separate functions HOT 3
- Last point of map-matched output lies too far from actual route HOT 4
- Additional CH config leads to error HOT 2
- Fail to build recent-Core (27 July 2020) HOT 4
- hmm-lib does not compile HOT 1
- Feature Request: Add elevation data from command line HOT 1
- Error building on master branch, map matching core could not be found in central maven
- Is there a way to download matching results? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from map-matching.