[OSM-dev] extract polygons from .osc

Andy Allan gravitystorm at gmail.com
Fri Apr 15 17:32:23 BST 2011

On Fri, Apr 15, 2011 at 5:08 PM, Steven M. Ottens <steven at minst.net> wrote:
> Hi all,
> Is there a way to extract polygons or bounding boxes with the areas that are
> changed from an .osc file? I noticed that for any changeset [1] the
> 'Changeset XML' [2] has a bounding box (but no changes) and the 'osmChange
> XML' [3] doesn't have a boundingbox, but does have the changes.
> I've got a tileserver with a osm2pgsql database which gets nicely updated.
> Now I want to refresh those tiles from which the data is/might have changed.
> I'm using MapProxy as tileserver and it allows for polygons and bounding
> boxes as input for a reseed. So I figured if I can extract the changed areas
> from the .osc file I can automatically reseed those areas with a simple
> script.

osm2pgsql will calculate the areas that have expired for you - the
advantage of this is that it can use other information to make better
calculations. For example, an .osc file might only contain one node
that has changed coordinates, and osm2pgsql can calculate the extent
of the forest multipolygon that now needs expiring. The .osc itself
doesn't contain enough information to tell you the ultimate impact of
all the changes.

osm2pgsql -e will calculate the expired tiles during a diff update,
and then converting tileids into polygons / bounding boxes for
MapProxy should be straightforward.


More information about the dev mailing list