[OSM-dev] Osmosis - Cutting out a bounding box from a diff file (.osc)

sly (sylvain letuffe) liste at letuffe.org
Wed Sep 5 13:24:41 BST 2012


On mercredi 5 septembre 2012, Stéphane Henriod wrote:
> Dear all

Dear stéphane,

> My problem is that, despite the *osm2pgsql -b* option, it seems that my
> bounding box is ignored and the full diff file is added to my database, As
> a consequence, the database is growing very quickly and includes lots of
> data outside of my area of interest.

I can confirm this behaviour of osm2pgsql, although I haven't digged in too 
much to see what this "-b" switch does in regard to diffs (if it does 
anything at all)
I't working for the first import, but diffs seams to be applied for the whole 
world.
Your finding about the table sizes seams that of slim tables 
planet_osm_rels/ways and I suppose nodes as well are filled with data out of 
the bbox.

> My question is thus: is it possible to cut out the bounding box from the
> diff file before calling osm2pgsql? 

I would say : not correctly unless you have a full database of the world 
somewhere 

> If I understand correctly, the 
> bounding-box task (
> 
http://wiki.openstreetmap.org/wiki/Osmosis/Detailed_Usage#--bounding-box_.28--bb.29)
> only works on planet files, not diff files. Correct?

Correct.

> Is there a way to get the following process working:
> 
>    1. Get the last hourly diff file
>    2. Extract from the diff file all the objects within my bounding box
>    3. Apply this to the PostGIS database with osm2pgsql

My guess is that "no", unless you have a database of the world.

The reason for that, (that's a guess) is that diffs (.osc) produced do not 
necessarly have geographic informations with objects other than modified and 
added nodes.

In a diff you can have changes about a way without any of it's constituent 
nodes (for instance, when the change only consist of tag changes, when the 
ways is changed to use other allready existing nodes, etc.)

This means that the diff is not enough to tell wether the modified 
way/relation is or isn't in you bbox, unless you have a world database to 
chech where it's nodes are.

However, the new introduction of "augmented diffs" :
http://lists.openstreetmap.org/pipermail/dev/2012-August/025487.html
might help doing what you want, but AFAIK, no tools can consume them yet.

Other option, is, depending of you bbox of interest, regional diffs from 
here :
http://wiki.openstreetmap.org/wiki/Planet.osm/diffs#Regionaly_limited_diffs
-- 
sly
qui suis-je : http://sly.letuffe.org
email perso : sylvain chez letuffe un point org



More information about the dev mailing list