-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tremendous memory usage due to deep data structures #114
Comments
Is there support in OSM API for getting specific revisions? |
Following the API documentation v0.6 Seems there is no filter or shallow option in history endpoint. Even official openstreemap.org site timeouts trying to view the history for this in my tests. But there is also an endpoint for version, and seems version is a positive integer growing sequentially, from 1. Then a workaround could be
import osmapi
import time
api = osmapi.OsmApi()
rel = api.RelationGet(2771761)
last_ver = rel['version']
super_nice_optimal_structure_for_my_specific_needs = [rel['version']]
for i in range(last_ver-1, 1, -1):
print('Getting ' + str(i))
rel_i = api.RelationGet(2771761,RelationVersion=i) # Error handling // retry as homework
super_nice_optimal_structure_for_my_specific_needs.append(rel_i['version'])
time.sleep(0.5) ;-)
print(super_nice_optimal_structure_for_my_specific_needs) In quick experiment this was using at most 43292 KB (~43 MB) (of course I am just storing I think this can be implemented per case in specific implementation but I am not sure if it worth to add this kind of access patterns in About the data structure, it could be a good idea to analyze better general alternatives but I think @metaodi could have a different opinion on this |
Yes it's certainly possible to implement this on top of OsmApi by requesting versions. So I don't think it's an urgent issue. But I can see the appeal to have a new flag |
It is not a big surprise but getting the history of a big relation with many edits takes enormous amounts of memory. For example,
api.RelationHistory(2771761)
(https://www.openstreetmap.org/relation/2771761) takes over 1,5GB of memory. This is because there is no way to specify/request shallow copies and the data is not exactly stored densely.Is there any workaround for that?
The text was updated successfully, but these errors were encountered: