[OSM-dev] A new way to split the planet
Nic Roets
nroets at gmail.com
Fri Aug 14 19:07:25 BST 2009
CM and Geofabrik both publish planet extracts by country / region. They are
great if you want to answer questions like "How many fueling stations are
mapped in ... ?". And they are great if you live on an island.
But if you want to travel from Brussels in Belgium to Rotterdam in the
Netherlands, you want a single extract that covers both, yet is small enough
to fit on your GPS. And if your software has access to many of these
overlapping extracts, they should preferably be rectangular so that it's
easy to programmatically to choose the best one.
So here is my process. All the data is at http://nroets.openhost.dk/bbox
1. Use the Mercator projection and divide the planet into 1024x1024 squares.
That means each square spans 0.35 degrees in the East West direction and a
similar amount North-South.
2. Count the number of OSM nodes in each square (density.csv).
3. Use an OO spreadsheet to choose the rectangles (density4.ods). OO will
makes it quite easy: As you drag to highlight a rectangle, it will display
the sum (of nodes) in the status bar. This way you can see how much data
will be in the rectangle. I stayed below 14,000,000 which works out at
.osm.gz of less than 300MB and gosmore files of less than 400MB. It also
works well if you compose expressions like MAX(SUM(A1:K12);SUM(D9:M21)),
because you can hit F2 to see how the rectangles overlap and even change
them. I ended up with 58 rectangles, which will increase as the planet gets
larger.
4. Copy and paste all these expressions to a text file and feed them to my
density.c program.
5. It generates a script that calls osmosis twice (density.sh). First for
Africa, Europe, Asia and Australasia, then for the Americas. This way you
can run it with only 4GB RAM. Edit it as desired.
6. It also generates an html image map for choosing a rectangle.
http://nroets.openhost.dk/bbox/density.html The rectangles in the default
images are smaller than the actual, larger rectangles which are shown after
hovering the mouse over them. Clicking on them will download the gosmore
files, but you can edit the html as desired.
Regards,
Nic
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20090814/47b009e4/attachment.html>
More information about the dev
mailing list