Would it be possible to have a sister project of OSM that could provide travelling speeds of certain ways? I’m thinking of something similar to how TomTom is able to predict traffic jams, but not the live-traffic part.
In short, I want to make a database so that everyone can query the time it takes to cross a crossing in a certain direction, or to ride down a way in a certain direction. Als depending on the time of the day.
For this purpose, we could index all GPX files with a certain tag, or index other GPX files send directly to the service.
I’ve thought out the database behind it, and there should be at least 3 tables: crossing, wayTime and crossingTime.
A crossing can consist out of several OSM nodes (close to each other), and is queryable via latitude and longitude bounding box.
A wayTime record has two crossings (a ‘from’ and a ‘to’) it has also stored the time takes according to one GPX file, and it has a timestamp of when that way was measured with the GPX
A crossingTime record has three crossings(a ‘from’, a ‘via’ and a ‘to’, since it’s also important to know the direction), and just as the wayTime record, it has a traveltime and a timestamp.
This database should be free dowloadable, so other apps can use it, together with diffs.
Indexing OSM data
Indexing the OSM data is a quite difficult job. First, you index all routable ways, with their node ids. Then you check out the nodes that belong to more than one way. The nodes should also belong to a class, depending on the way type they connect (a motorway has a bigger class than a residential).
Depending on the class of the node, it has to be joined with other nodes to form one crossing. F.e. on a primary road, all crossing nodes closer than 70m are joined, while for residential nodes, it’s 20m. The node class will also be stored, as the queue for primary roads can be bigger than the queue for residential roads. So the crossing time should be indexed over a bigger distance (see indexing GPX).
If that is done, the crossing table will be complete.
Indexing a GPX would be quite simple. For each node in the GPX, you have to check if it’s part of a crossing or not. This is done by querying a bounding box with crossings in it, and for each crossing checking if it is close to one of the nodes of the crossing (taking the node class into account). And every time you switch from being on a crossing to not being on it (or the other way around), you create a new record for it.
I haven’t figured out how updating the OSM data would go though. There are multiple scenarios in which a crossing node can be deleted, but the crossing stil exists, or a node that suddenly will only be part of one road.
Do you think there qould be room for this on OSM servers? As a sister project, I don’t have the hardware to do this. It could provide valuable free data about routing. And routing apps could use it in combination with OSM data.