[OSM-dev] Read osmChange files with Pyosmium

G. Allegri giohappy at gmail.com
Sat Mar 18 22:14:21 UTC 2017


Hi Sarah,
thanks a lot for your replies and for clearing the terms. I was misusing
those concepts, now everything is clear and works fine ;)

Regards,
Giovanni

PS: sorry for the late reply but your responses were considered spam by
Gmail.

Il 18 mar 2017 10:52, "Sarah Hoffmann" <lonvia at denofr.de> ha scritto:

> Hi again,
>
> looking at the code again, it turns out changesets are actually
> implemented.
>
> 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:
> http://planet.osm.org/planet/changesets-latest.osm.bz2
>
> 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"/>
> </changeset>
>
> 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.
>
> Kind regards
>
> Sarah
>
> 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
> >
> > Sarah
> >
> >
> > 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 [1] 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
> > >
> > >
> > > [1] http://osmcode.org/osmium-tool/manual.html#working-with-changesets
> >
> > > _______________________________________________
> > > dev mailing list
> > > dev at openstreetmap.org
> > > https://lists.openstreetmap.org/listinfo/dev
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20170318/fdc45dda/attachment.html>


More information about the dev mailing list