Almost but not quite;
For the following reasons.
1/The devices generate the routes offline, not on a common server, and therefore may have different versions of openstreetmap roads, which mean someone can edit/adjust the roads and change the position of the nodes (which have no common index that I can get hold of programatically) , these nodes can be edited quite frequently . I have various ideas for ensuring consistency including staging versions and running different servers for each version but it gets messy fast. Offline routing is a must for this app.
2/ Whilst comparing exact nodes could tell me where the routes intersect and decouple, it wouldn’t tell me if point A is on or near either one of those routes because point A is a user generated location ,
it has a different lat/lng to the nodes used on the route. It may also be several meters off the route but near enough for my purposes to be relevant . If a route contains a long straight road with no side roads the nodes can be several hundred meters apart.
I have coded some math in java that I use on the devices that can determine if a point is within 2 nodes, with a tolerance, like so, it’s much more specific than a square bounding box and alters its shape to the bearing, rather than a boundingbox that varies with bearing.
The node index tells me where it is on the route, but the node index is redundant off the device as it won’t apply to another users route.
But if I could run that code for each two nodes on the route (server side) then that would suffice.
but, I also need to go through the other users (can narrow it down by road name) and compare their routes to check that that point , is between two points on their routes so I can notify them there is new data on their route.
So to clarify,
When starting a route, each user would upload all points on their route, and the names of all the roads on their route to a table on your servers db.
They then download all of the existing notes/ points on the db that
a) have common roadnames,
b) fall between the nodes on the the requesting users (entire) route. (perhaps minus the roads they have already traversed)
This is then stored on the devices local db, and I determine further relevancy locally with bearings/time etc
When a user makes a note (ice, accident etc) this is sent to the server with the roadname and the lat/lng location.
then the server adds it to the db,
and then sends that data, (or sends a push message signalling the device to poll the db) to pull any new data) to ALL users who have a route that is traversing the same road name/s , and where their route has a nodes that encompasses the new data as shown by the green box.