Hi Peter, yes exactly that was the problem. Thx that helped a lot. I got it to work :) But that means I need to handle the start/end edge separately?
Right now I still matching on the phone. But for a bigger amount of GPS points it would make sense to do that on the server. If I do the matching on the server and as long as I don't reimport from a different osm file the graph should work? And again thx for the great support :) Amazing project! All the best Markus On Monday 09 March 2015 20:50:12 Peter wrote: > Hi Markus, > > do you find that all but the starting and ending edges do match or none > at all? > > If only starting and ending edges, yes you will have to map the virtual > edges to the real edges like I do in the map matching code in the > fillVirtualEdges with the virtualEdgesMap: > https://github.com/graphhopper/map-matching/blob/master/src/main/java/com/graphhopper/matching/MapMatching.java#L525 > > (ignore the traverseToClosestRealAdj method for this, as your situation > is not dependent on the direction I think) > > Kind Regards, > Peter > > On 09.03.2015 14:11, Markus wrote: > > Hi Peter, > > > > Any hint how I get the QueryResult in the calcWeight? > > So far I was using: > > > > public class MyWeighting extends PriorityWeighting { > > ... > > @Override > > public double calcWeight( EdgeIteratorState edgeState, boolean reverse, int > > prevOrNextEdgeId ) > > { > > double weight = super.calcWeight(edgeState, reverse, prevOrNextEdgeId); > > if (Double.isInfinite(weight)) > > return Double.POSITIVE_INFINITY; > > double tempWeight =weight / (0.5 > > +encoder.getDouble(edgeState.getFlags(), KEY)); > > int calcEdge=edgeState.getEdge(); > > if(myWeightList.containsKey(calcEdge)) { > > //do some calculation > > return (myWeight!=0 ? tempWeight*myWeight : tempWeight); > > } > > else > > return tempWeight; > > > > for the creation of myWeightList I'm use > > QueryResult myQR = index.findClosest(tmpPoint.getLat(),tmpPoint.getLon(), > > EdgeFilter.ALL_EDGES); > > in a different class. > > > > I could use for calcEdge the findClosest() with > > edgeState.fetchWayGeometry.getLat/getLon and create a QueryResult > > but I guess that is not the way to go. > > > > > > btw I forgot to mention I'm using Graphhopper 4.0.0, if that is important. > > > > thx Markus > > > > On Monday 09 March 2015 11:07:15 Peter wrote: > >> Hi Markus, > >> > >> you can use a method like this. Try QueryResult.closestEdge.getEdge > >> instead of the edgeIds from the EdgeIterator of that query point as they > >> are 'virtual edges'. > >> > >> But be aware that if you reimport from a new OSM file you will need to > >> re-do the edgeID mapping. > >> > >> Regards, > >> Peter > >> > >> On 08.03.2015 15:07, Markus wrote: > >>> Hey, > >>> > >>> I'm having an Android App and bunch of GPS points I'm loading them > >>> from a server. Each GPS point has a weighting value assigned and should > >>> alter the weight of an edge they belonging to. > >>> > >>> I'm struggling with assigning my data to the right edges to use them for > >>> the path calculation. > >>> > >>> I'm using getLocationIndex() findClosest() and assign the weight to the > >>> edge and store this data in a Map during an AsyncTask. > >>> In the weight calculation I'm checking if the edge in my Map is the same > >>> as > >>> the one graphhopper is handling at the moment and if so add the weighting > >>> to the calculation. > >>> > >>> But the edges stored in the Map are different from the once I get with > >>> getEdge() from EdgeIteratorState (the doc also states that I shouldn't > >>> make > >>> any assumptions about the concrete values). > >>> Is there a way to get the EdgeID so I can store my information in the Map? > >>> > >>> Is there a nice way to solve that? > >>> > >>> > >>> Thx Markus > >>> > > > _______________________________________________ > GraphHopper mailing list > [email protected] > https://lists.openstreetmap.org/listinfo/graphhopper > _______________________________________________ GraphHopper mailing list [email protected] https://lists.openstreetmap.org/listinfo/graphhopper
