I have a set of GPS points which I have snapped to the OSM network. In the below screenshot GPS points are red, snapped points are green.

I want to calculate the shortest path that includes all of these green way points. My solution is to calculate the shortest path between each pair of points and finally concatenate the results.
My problem is that dijkstra_sp will not accept arbitrary points on the OSM network. My snapped points are not necessarily in the ways table because they were calculated using the following logic.
1) Find the closest way to a given GPS point. 2) Using interpolation, find the closest point on this way to the GPS point.
The snapped points are not in the ways table because they were derived by interpolation.
So my question is: How do I calculate the shortest path between two points on the OSM network that are not necessarily in the ways table?
Kind regards, Cathal

