[OSM-dev] osm2pgsql bbox filter when applying diffs?
Frederik Ramm
frederik at remote.org
Fri Mar 26 08:14:33 GMT 2010
Hi,
Peter Körner wrote:
>> Is there a way to process the diff files in a way that the diff only
>> contains changes in my area of interest?
> If you're fetching the diffs with "osmosis --rrii --wxc", can't you plug
> a --bb task afzter that? Or does this task not work with
> changeset-streams?
The latter.
> If so, this would be the place to implement this
> functionality, wouldn't it?
No. Imagine a relation with 500 members and someone changes a tag. The
relation itself will be contained in the osmChange file, but none of the
members will because they are unchanged. Any task handling the osmChange
file will not know anything about the spatial extent of the relation.
This would only work if the geometry of ways and relations was included
in the osmChange file, significantly increasing their size - or if the
process which wants to cut a section out of the osmChange file has
access to the underlying data.
With osmosis you can do a --rrii --rx --ac --bb --wx to read your xml,
apply the change, cut out the area of interest (again) and save it. But
that is impractical for something like minutely diff application.
It would have to be done in osm2pgsql - when applying a change, it would
have to do the following:
* if change type = modify or delete: apply change as long as object to
be modified or deleted is present in local data base (I think it does
this already)
* if change type = create and object type = node: apply change only if
node is within bbox
* if change type = create and object type != node: apply change only if
referenced members are present in local data base
A problem arises (as always) if you have objects that are half in and
half out; they will need special treatment. There will be difficult
scenarios (nodes A, B created outside bounding box; way C created to
connect A and B; all these changes are ignored; later node A is moved
inside the bounding box in a different osmChange file; how will you now
get hold of way C which suddenly has entered your area of interest?).
Bye
Frederik
--
Frederik Ramm ## eMail frederik at remote.org ## N49°00'09" E008°23'33"
More information about the dev
mailing list