[OSM-dev] Read osmChange files with Pyosmium
lonvia at denofr.de
Sat Mar 18 09:52:24 UTC 2017
looking at the code again, it turns out changesets are actually
I suspect that you are mixing up terminology here. A changeset
in osmium, is the collection of metadata about a particular
set of data that was uploaded. Changeset information is
available in a separate file here:
The XML for changesets looks something like that:
<changeset id="15449959" created_at="2013-03-22T02:09:28Z" num_changes="0" closed_at="2013-03-22T03:09:28Z" open="false" user="javiarch" uid="1116739">
<tag k="comment" v="pje sargento Cabral"/>
<tag k="created_by" v="iD 0.0.0-alpha3"/>
<tag k="imagery_used" v="Bing"/>
You probably want to process OSM data change files from
http://planet.osm.org/replication/. These files are normal
data files. so you have to process them using the data
callbacks node(), way(), relation(). Have a look at the
osm_diff_stats.py example, to find out how to distinguish
between created, modified and deleted objects.
On Sat, Mar 18, 2017 at 08:20:26AM +0000, Sarah Hoffmann wrote:
> Hi Giovanni,
> the ChangeSet type is currently not exported into a python type
> but it's really easy to do. Could you open a feature request at
> https://github.com/osmcode/pyosmium/issues and I'll see to it to
> add support for it.
> Kind regards
> On Fri, Mar 17, 2017 at 12:33:01PM +0100, G. Allegri wrote:
> > I've just started giving a look to Pyosmium. I've done tests based on the
> > examples from its repo and everything works fine.
> > I would like to replicate osmium changeset-filter  and I'm striving to
> > make the osmium.SimpleHandler parse the changesets from an osmChange file.
> > I've tried:
> > >>>class MyHandler(osmium.SimpleHandler):
> > ... def changeset(self,changeset):
> > ... print changeset
> > >>>handler = MyHandler()
> > >>>handler.apply_file('mychange.xml>')
> > but nothing happens. No errors, no outputs.
> > I've tried to setup the osmium.io.Reader manually, and setting the entity
> > bit:
> > >>>reader =
> > osmium.io.Reader('mychange.xml',osmium.osm.osm_entity_bits.CHANGESET)
> > >>>omsium.apply(reader,handler)
> > No output again.
> > First question: is it possible to parse osmChanges with Pyosmium? If yes,
> > what's the right way to do it?
> > Thanks a lot,
> > Giovanni
> >  http://osmcode.org/osmium-tool/manual.html#working-with-changesets
> > _______________________________________________
> > dev mailing list
> > dev at openstreetmap.org
> > https://lists.openstreetmap.org/listinfo/dev
More information about the dev