[OSM-dev] Cutting the planet into tiles

Ben Supnik bsupnik at xsquawkbox.net
Thu Dec 4 23:47:22 GMT 2008

Hi Guys,

Frederik, thanks - I am stupid...I found your code shortly after my 
post...should have Googled first!

Number 9 was the main item I was concerned about...e.g. I can't _quite_ 
be sure about data integrity if a node might not be present in all tiles 
that contain ways that reference it.  Most of OSMCut looks very similar 
to my algorithm...the main differences are that I was looking to:

1. Use bounding boxes - bounding box of a way is union of bounding box 
of nodes, and then the bounding box of the nodes is grown by the union 
of all ways that reference it.  This takes a few linear passes over the 
data, but should theoretically give me all of the nodes I need.  (And 
probably a bunch of others I don't care about.)

2. I was looking at using a sorted array for nodes rather than a hash 
table...log-time lookup might be too slow though...

Shaun - my end goal is virtual world modeling of the entire planet, and 
the tool the data is destined for is 1x1 degree tile based.

I think after splitting into "rough cuts" I'd use something else (GRASS 
or code based on CGAL) to cut down to true 1x1 clipped tiles.

Frederik, let me see if I can modify osmcut to use bounding 
boxes*...this would let me output nodes to _every_ tile that needs them 
(as well as, probably, a bunch of tiles that don't, if ways are huge 
compared to tiles).


* My bounding box scheme also makes assumptions about the tiling scheme, 
but then if osmcut has to open a file descriptor per tile, your 
assumptions and mine are quite similar. :-)

Shaun McDonald wrote:
> On 4 Dec 2008, at 23:18, Ben Supnik wrote:
>> Hi,
>> Andras and I were looking at cutting the OSM planet file into 1x1 degree
>> tiles (including at least enough nodes outside the tile to correctly
>> "chop" a way at the tile boundary).
>> I think I have an algorithm that can do this in four passes over the
>> planet file on a 32-bit machine, using perhaps 2-3 GB of RAM.
>> Before I go forward...am I reinventing the wheel?  I know that osmosis
>> can do this kind of thing, but my understanding is that it extracts a
>> finite number of "streams" from the data...we actually want to take all
>> of the data and split it into 64800 parts.
>> If no one has something like this and I can get it working, I'll post
>> the code somewhere. :-)
> What is the end use case of splitting the data this way?
> Are the current country (or in the case of the US, state) extracts not 
> suitable?
> Shaun

Scenery Home Page: http://scenery.x-plane.com/
Scenery blog: http://xplanescenery.blogspot.com/
Plugin SDK: http://www.xsquawkbox.net/xpsdk/
X-Plane Wiki: http://wiki.x-plane.com/
Scenery mailing list: x-plane-scenery at yahoogroups.com
Developer mailing list: x-plane-dev at yahoogroups.com

More information about the dev mailing list