I'd like to extract small xml files of tiled osm data from a pbf file. These xml files should contain data square map boxes. I'd like to have one xml file for each tile that is touched by the original pbf file. I used osmosis to extract one tile, which took 10 minutes for a pbf file of 2GB. This is probably due to the size of the pbf file (and IO speed), and not dependent on the size of my bounding box. Is there a tool that lets me extract lots of bounding boxes at once? asked 10 Apr '15, 17:51 Marian edited 10 Apr '15, 17:54 |
3 Answers:
Yes, the OSM History Splitter which processes history files as well as normal PBFs. answered 10 Apr '15, 18:29 Frederik Ramm ♦ |
You can try osmconvert ... it has several clipping features. Read the instructions in wiki page carefully. answered 10 Apr '15, 19:26 stephan75 Can you provide an example of how to extract two bboxes from one pbf file using osmconvert? (10 Apr '15, 19:54) Marian Did you try the clear example at https://wiki.openstreetmap.org/wiki/Osmconvert#Clipping_based_on_Longitude_and_Latitude If you want two bboxes extracted, you should call this command twice with diferent parameters ... Success? (11 Apr '15, 06:48) stephan75 I have to do this more than 100k times. I was wondering if there is a more efficient way than parsing the entire pbf file each time. (12 Apr '15, 23:13) Marian |
If you want to create a huge number of extracts then perhaps installing a local Overpass database and extracting from there could be the fastest way. See http://overpass-api.de/no_frills.html for instructions. answered 19 Apr '15, 18:47 Frederik Ramm ♦ Why do you recommend creating a local overpass database over using an existing overpass service? Even in production, 10000 requests per day is way beyond what I need. Is the local db faster? (10 Nov '15, 23:21) Marian If you're just doing this once for 5 or 10 bounding boxes then I guess it's ok. Else you come close to abusing the existing Overpass server - the local db may not be faster but it sure is fairer! (11 Nov '15, 01:26) Frederik Ramm ♦ The wiki page says 10.000 requests are ok. If 10 already is abuse, I'll sure set up my own. https://wiki.openstreetmap.org/wiki/Overpass_API (11 Nov '15, 06:30) Marian |
It doesn't compile on my ubuntu machine... (fails to find
boost/utility.hpp
)@Marian Please install
libboost-dev
.I got it to run but it crashes if there are more than 30 bounding boxes in the config file.
Turns out RAM usage grows quickly with the amount of bounding boxes so only a few bboxes can be extracted at a time.
You might want to try the
--hardcut
option which uses less RAM. Else just run the program multiple times. The problem is (you say you want to produce > 100.000 extracts) that a list of nodes and ways needs to be kept in memory for all these, and most programs will use an array-like structure for efficiency. It might be possible to switch osm-history-splitter to a list-like structure using small changes in the code.