Closed lisette-espin closed 2 years ago
Dear Lisette,
Thanks for raising this issue. You are right, there has been a breaking change in v0.3.3 related to the cacheDir
parameter. Some parts of the documentation were still outdated and pointed to the old way of providing the cacheDir
parameter. I can confirm that the following code does not work any longer:
from OSMPythonTools.overpass import Overpass
overpass = Overpass(cacheDir='saveCacheHere')
Instead, I have introduced a new CachingStrategy
, which allows for even more flexibility.
from OSMPythonTools.cachingStrategy import CachingStrategy, JSON
from OSMPythonTools.overpass import Overpass
CachingStrategy.use(JSON, cacheDir='saveCacheHere')
overpass = Overpass()
You can find the documentation of the CachingStrategy
in the General Remarks Section.
The (outdated) parts of the documentation you have referred to have now been updated accordingly.
I hope this solves the issue you have raised.
Best, Franz-Benjamin
PS: If you plan to publish a paper, feel welcome to cite this software by referring to the reference, which you can find under “Cite this repository” on the “home page”. Thanks
thanks a lot for the example, the pointers and the updates :-)
One quick last question. If I use the new version, would the old cache (stored in disk by the previous version) still be loaded by the new mechanism? If I remember correctly, the old cache was json
by default. So if I use a json
strategy (as your example) it should work, right? or?
Sure, we will cite the paper!
You are welcome!
Yes, if everything works like it should, the old cache should be used automatically because the JSON
serialization should be the same. If you have larger chunks of data that you download and cache, I suggest (at least for new projects) to use the Pickle
serialization, as it has some obvious advantages: it is smaller in file size as it can be compressed via gzip
, faster to read and decode, just one file to handle, etc.
Thanks for citing the paper. I would be interested to see your final paper too. Feel welcome to share it with me via mail@mocnik-science.net Thanks in advance!
Hi, I'm getting this error
__init__() got an unexpected keyword argument 'cacheDir'
when creating an instance ofOverpass
. I just upgradedOSMPythonTools=0.3.2
toOSMPythonTools=0.3.3
(before I didn't have this problem).So, It seems that the newest version has changed the constructor and instead of
cacheDir
it accepts a cache strategy. Is this correct?At the same time here it is mentioned: "Please observe that the constructor of the class Overpass again accepts the parameters endpoint, cacheDir, and waitBetweenQueries. To query historical data, we can easily add a date:"
Could you please clarify this? and if
cacheDir
does not exist anymore, could you please provide me with an example or pointer to how to specify the directory where I want the cache to be stored?Thank you!