[OSM-dev] osmosis, bounding boxes and updating
David Paleino
dapal at debian.org
Tue Mar 22 15:13:13 GMT 2011
On Tue, 22 Mar 2011 15:55:03 +0100, Martijn van Exel wrote:
> I think I found the answer to my own question:
>
> http://www.mail-archive.com/dev@openstreetmap.org/msg03530.html
>
> In short: it's not possible to combine change streams with bounding
> boxes / polygons.
>
> Right?
No.
With some hackery, I did it once :)
1. download an initial complete dump of the area you want, and call it
"complete.osm"
2. in a crontab, to be run each minute (if you want minutely diff):
$ osmosis \
--read-replication-interval workingDirectory=... \
--simplify-change \
--write-xml-change changes.osc.gz
$ osmosis \
--read-xml-change changes.osc.gz \
--read-xml file=complete.osm \
--ac \
--bounding-polygon file=yourpolygon.poly \
--write-xml complete_new.osm
$ osm2pgsql \
--merc \
--extra-attributes --style $BASE/osm2pgsql.style \
complete_new.osm && \
mv complete.osm complete.osm.bak && \
mv complete_new.osm complete.osm
Check the manpage/web/--help for what to put in the workingDirectory=
parameter of --read-replication-interval.
Also, the last osm2pgsql acts on "complete_new.osm", which is renamed to
"complete.osm" (so that it's ready for the next crontab run) only if everything
goes well. In case of errors, there's always "complete.osm.bak" :)
This worked one month ago. I didn't check now, because I shut my app down, so
can't tell if anything changed; but I don't think so.
Also, my app originally had two (or more) different polygons imported and
rendered, and the script put in crontab is a bit more complicated (and
generalized) than this. But this should be sufficient to do what you want :)
Kindly,
David
--
. ''`. Debian developer | http://wiki.debian.org/DavidPaleino
: :' : Linuxer #334216 --|-- http://www.hanskalabs.net/
`. `'` GPG: 1392B174 ----|---- http://deb.li/dapal
`- 2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20110322/d5574299/attachment.pgp>
More information about the dev
mailing list