I would like to ask if there's an easy way to query OSM changesets' information like user, timestamp, comment and hashtags in that changeset. In particular I would like to retrieve all the user names of the users which modified an area saving their changesets with a particular hashtag (similarly to default hashtags in HOT projects https://tasks.hotosm.org/)
My idea is to download the OSM data relative to my area of interest (in this case a country, taken from https://osm-internal.download.geofabrik.de/africa/senegal-and-gambia.html#)
So what I did until now is to download the following files from GeoFabrik.de:
senegal-and-gambia-latest-internal.osm.pbf
senegal-and-gambia-internal.osh.pbf
And I tried to run the following code (taken from https://oslandia.com/en/?s=timeline+handler) using Python and pyosmium library:
import osmium as osm
import pandas as pd
class TimelineHandler(osm.SimpleHandler):
def __init__(self):
osm.SimpleHandler.__init__(self)
self.elements = []
def add_elements(self, e, elem_type):
self.elements.append([elem_type,
e.id,
e.version,
e.visible,
pd.Timestamp(e.timestamp),
e.uid,
e.changeset]) #only changeset id
def node(self, n):
self.add_elements(n, 'node')
def way(self, w):
self.add_elements(w, 'way')
def relation(self, r):
self.add_elements(r, 'relation')
tlhandler = TimelineHandler()
tlhandler.apply_file("senegal-and-gambia-latest-internal.osm.pbf")
colnames = ['type', 'id', 'version', 'visible', 'ts', 'uid', 'chgset']
elements = pd.DataFrame(tlhandler.elements, columns=colnames)
This doesn't solve my problem as I'm searching for changesets' information and not OSM data itself.
Maybe I'm missing a snippet to be added in the handler similar to:
...
def changeset(self, c):
self.add_elements(c, 'changeset')
...
I tried to add this snippet, but the handler gives no result.
Actually I'm wondering if I'm missing something in the data structure of osm/osh .pbf files, something on pyosmium or if the changeset information I'm searching for is contained in such files.
If the task cannot be performed with pyosmium and GeoFabrik, how can I do such operation?