I'm looking to render streets based on OSM data. I'm planning to split planet.osm into many smaller tiles that clients can load/unload.
A tile should contain all nodes that have at least 1 node in its bounding box, as well as all nodes that are in the bounding box. It should not contain any nodes that are outside of its bounding box, i.e. the equivalent of osmium extract's --strategy normal.
The twist is: I would like to assign a custom "Connected Group ID" tag to each way. Different ways that are connected to each other (directly or through other ways) should be tagged with the same connected group ID, even if the node or way that connects them is on a different tile altogether. The purpose of that is simplify handling on the client side - clients would need to render a connected groups as one cohesive mesh, in order to incorporate intersections into the geometry nicely. As I stream tiles in and out, directly knowing which ways are, or will later be, connected, would help immensely.
What's the best way to do this?
My idea so far would be to run osmium extract for a given tile with strategy "smart". Afterwards, I could have a script run through the generated file, run some simple "connected components" graph algorithm, tag each way with its connected group ID. And then, filter out all nodes that are outside of the tile's actual bounding box, and store everything again.
I think that should work, but it seems a little troublesome. Is there any better way to do this? Leveraging Osmium would be ideal, but I could definitely look at other tools as well.