Diff files with OSMPythontools.overpass

How can I query for diff files using OSMPythontools? Probably used wrong search terms but can’t find how to adjust my query so I only get the changes that occurred since my download. The query I currently use is:

query = overpassQueryBuilder(
bbox=(mila, milo, mala, malo),
elementType=[‘node’, ‘way’, ‘relation’],
selector=‘“tourism”=“{}”’.format(label),
includeGeometry=True
)

Questions:
How do I adjust above query so I only get items that changed since a certain date?

I assume that the diff file contains all the data of the POI that have changes and I can use the same script to extract the wanted data as I did with the original query. Is this assumption correct?

Do items that have been deleted/removed from the database occur in the diff file? If so, how can these be identified? If not, how can I find the items that are deleted?

It looks to me you are trying to use:

to retrieve some data you are interested in.

I would first use the overpass website to create a query that works and only then switch back to python.

For overpass there is quite some documentation available, for a start I would try something based on:

If you can not get this to work as you like, post the query here and indicate what it is not yet doing.

Thanks for the reply. Though I’ve understood that the same query language should be used, I find that the web version and OSMPythontools, but I find the formatting is different. I’m unable to find anything regarding diff files with regards to OSMPythontools. I get it to work in the web version based on Overpass API/Overpass QL - OpenStreetMap Wiki, but I can’t get it to work with OSMPythonTools. So the way I look at it, it should be just a formatting issue.

In the web version I can query the diff file with:

[out:xml][timeout:25][diff:“2023-01-01T00:00:00Z”];
nwr"tourism"=“attraction”;
out geom;

But for some reason I don’t get it to work in my code. The query I use:

query = overpassQueryBuilder(
bbox=(mila, milo, mala, malo),
elementType=[‘node’, ‘way’, ‘relation’],
selector=‘“tourism”=“{}”’.format(label),
includeGeometry=True,
)

I fire off the query via:

result = overpass.query(query, timeout=25)

The seemingly obvious approach would be to add the diff statement to the last statement, but that results in a ‘unexpected keyword argument’ error. Tried also a few ways to add it to the query itself but I don’t get it to work.

If I am correct the problem is getting the diff data, normal queries are fine with OSMPythontools, correct?

If so, reading the documentation I think that OSMPythontools do not support it.

You could try it with another python library

This library seems to use plain overpass queries.

Thanks, I’ll have a look at overpy.