[OSM-dev] Merging pbf files problem?

marqqs at gmx.eu marqqs at gmx.eu
Thu Dec 23 01:15:21 GMT 2010


> Since the USA is such a large proportion of the whole planet file
> (probably over 50%) I believe most people import the whole planet file
> instead of trying to extract the US data.
As far as I remember (bz2 compressed files):
World 13 GB
USA 3 GB
Europe 6 GB
But the suggested way, to download the planet.osm to extract the whole USA seems reasonable to me. I did the same for a part of europe two weeks ago; it worked perfect.

First I had to create a border polygon for the selected region. It's quite simple: draw a closed polygon with JOSM and translate it to a .poly file; use the script from Frederik. By the way: thanks! :-)
http://wiki.openstreetmap.org/wiki/Osmosis/Polygon_Filter_File_Format#Getting_polygon_files
But I am sure there already is a border polygon for USA you can download from somewhere. Oh - I just found one:
http://trac.openstreetmap.org/browser/applications/utils/osm-extract/polygons

Now you can download the planet.osm file AND clip your region in the same step:

wget -O - http://planet.osm.org/planet-latest.osm.bz2 |bunzip2 |./osmfilter --drop-changesets |./osmchange -B=usa.poly |gzip -1 >usa.osm.gz

If you want to, you even could apply the latest daily change files (.osc) in the same run. Just in case the planet file would be more than one day old.
Descriptions:
http://wiki.openstreetmap.org/wiki/Osmchange_%28program%29
http://wiki.openstreetmap.org/wiki/Osmfilter
(If you want to keep the change sets in your .osm file, you do not need to apply the osmfilter program, of course.)

Maybe this is what you want to do after you have downloaded the planet file:
http://wiki.openstreetmap.org/wiki/Daily_update_an_OSM_XML_file

Markus



More information about the dev mailing list