Getting time taken for the edge using GraphHopper map matching

المشرف العام

Administrator
طاقم الإدارة
Here is the GPX data I am giving to GraphHopper Map matching library:

private List getList(){ List sampleEntries = new ArrayList(); GPXEntry point1 = new GPXEntry(13.0009316,77.5947316, 1431849367077L); GPXEntry point2 = new GPXEntry(12.9868999,77.6042,1431849683112L); GPXEntry point3 = new GPXEntry(12.9867766,77.6043633,1431849718336L); GPXEntry point4 = new GPXEntry(12.98658,77.6043283,1431849752169L); GPXEntry point5 = new GPXEntry(12.9846133,77.6052366,1431850069237L); sampleEntries.add(point1); sampleEntries.add(point2); sampleEntries.add(point3); sampleEntries.add(point4); sampleEntries.add(point5); return sampleEntries;}It is list of GPXEntry objects each containing lat, long and the timestamp of vehicle when the location was recorded.

Now, with map library, I am able to get edges and path using Dijkstra's algorithm. The QueryResults object has the following:

for (QueryResult item : queryResult) { System.out.println("Snapped position: "+ item.getSnappedPoint()); edgesMap.put(item.getClosestEdge().getEdge(), item.getQueryDistance()); }I am getting edge ID and in the end the distance calculated is also correct when I compare with GoogleMaps distance. But, I want to use the timeStamp(epoch) data which I have given in the GPX data. I am assuming the library creates edges based on location points I have given and snaps it to actual route referred by OSM file.

I want to know for each edgeID, how do I get the time taken? For e.g., time between point1 and point2 should be (1431849683112L-1431849367077L). Does the library provide anything for this or I need to do it separately.



أكثر...
 
أعلى