This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Is it possible to apply a bounding polygon to a changeset before applying it?

2
1

I've got a copy of planet.osm.pbf and a subsection op_area.osm (bounded by bounds.poly) which covers several US states.

I've also set up a way to get the planet.osm diffs each week (rssdownloader + rtorrent + http://osm-torrent.torres.voyager.hr/files/rss.xml, for the curious), and it's trivial to automatically apply the diff to planet.osm.pbf and write out an updated version. Then I can clip the planet whichever way I want, and write a new op_area.osm.

The problem is, clipping the planet after applying a changeset takes ~6 hours with my current hardware. Is it possible to apply the planet-based diffs to op_area.osm using osmosis (or some other tool) without needing that intermediate step? I couldn't find any pipeline items that can take a change stream and apply bounds.

asked 22 Apr '14, 15:19

BarqsDew's gravatar image

BarqsDew
46115
accept rate: 0%

edited 22 Apr '14, 15:23


One Answer:

2

Do not clip the planet after applying diff; clip it while doing so. Most of the time spent doing this is very likely the reading and writing of the data. Your toolchain seems esoteric to me; what people would usually do to solve your problem is (all on one line, written here on multiple lines for clarity)

osmosis
   --read-replication-interval
   --read-pbf mylocalregion.osm.pbf
   --apply-diff
   --bp file=bounds.poly
   --write-pbf mylocalregion-new.osm.pbf

This is extremely unlikely to take six hours even on small hardware! Working with .osm.pbf files (and not with .osm.bz2 files or plain .osm files) is essential here for speed; if your CPU is particularly weak then adding "compress=none" to the write-pbf task could also improve things.

Before you can run Osmosis in the above fashion you will have to initialize the replication loading (--rrii, and modify configuration.txt if you want hourly or daily updates). You can of course download the diffs your way too and then replace the --read-replication-interval with a --read-xml-change myfile.osc.

answered 25 Apr '14, 23:50

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

Source code available on GitHub .