Binary format and grid split

Surely this has been done so many times. For rendering, I’m looking to split a large set of xml OSM data into equal sized grid and save them in a compact binary format on disk. So my needs are:

  1. Split OSM data into equal sized square grid.
    While nodes can be grouped into each square in the grid easily, ways and relations can span multiple squares. How best to handle?

  2. Convert XML OSM data into compact binary files.
    Though probably ideal, OSM_Mobile_Binary_Format doesn’t seem defined or ready.
    So there is OSM Binary Format or OSMBin. Which format has tools that already does 1)?

Maybe josm/osmosis already has command line tools?

I’ve never used a tool like that, and I’m not sure if any established solution exists. The Wiki lists some tools such as Splitter and Osmcut. But keep in mind that I have not tested them, and I don’t know how they handle ways/relations spanning multiple data tiles. Unfortunately, they also don’t appear to be particularly well documented.

There is also an ongoing thesis project “Segmentation of OpenStreetMap Data - Generating, Merging, and Distributing Tiles” at the University of Bremen that is related to this topic, but I assume that results are still a few months away.

The only widely used compact format for OSM files I’m aware of is the .osm.pbf format.

Looks like osm.pbf is the most mature. Either that or I will have to design a custom format. I looked the descriptions of the splitting tools. Splitter at least seems to produce nodes where line segment crosses tile boundaries, and ways/relations will be split as well. This means it would be hard to tell that each split ways/relations actually belong to one way/relation.

Also, does there exist an open source map renderer for OpenGL devices such as iPad. Such renderer would translate .osm data into a list of triangles/quads for rendering instead of lines because thick lines are not supported in OpenGL es.

Thanks