I have been trying to reconcile the coordinates returned by the matching geometry and the nodes in each leg when doing a match call with annotations=true
overview=full
and geometries=geojson
.
I would like to understand how to align the node IDs with the lat/lon of a coordinate geometry.
My understanding is that there is a 1:1 mapping between the coordinates and the nodes in the legs.
I have tried "simplifying" the node IDs returned in the annotations by doing the following:
Append the first leg annotations to your result.
Repeat the following for each extra leg:
a. Trim the first two nodes from the start of the next leg annotation to append
b. Append the trimmed leg annotation to your result
Then I remove the locations returned by the waypoints from the coordinates in the geometry. After, I try to line up the simplified node IDs with the remaining coordinates. However, this method end up with a couple (and sometimes a few) extra points which we aren't able to explain or figure out how to filter out.
Anyone have a more reliable method for solving this? Appreciate all the help. Thanks!