You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
is it possible to track apply_file progress? The simplest way might be to add a progress(self, percentage, total) member function to the osmium.SimpleHandler, and if present, it would get called. Thanks!
The text was updated successfully, but these errors were encountered:
This is possible for a subset of uses for apply() but not exactly trivial. libosmium's internal apply() would need to be replaced with a custom processing function that loops over the buffers, calling a custom callback after processing the data in each buffer.
You can always track progress on your own. Here is osm_file_stats.py extended with tqdm:
"""Simple example that counts the number of objects in an osm file.Shows how to write a handler for the different types of objects."""importosmiumasoimportsysimporttqdmclassFileStatsHandler(o.SimpleHandler):
def__init__(self, reporthook):
super(FileStatsHandler, self).__init__()
self.nodes=0self.ways=0self.rels=0self.reporthook=reporthookdefnode(self, n):
self.nodes+=1self.reporthook(1)
defway(self, w):
self.ways+=1self.reporthook(1)
defrelation(self, r):
self.rels+=1self.reporthook(1)
if__name__=='__main__':
iflen(sys.argv) !=2:
print("Usage: python osm_file_stats.py <osmfile>")
sys.exit(-1)
withtqdm.tqdm() aspb:
h=FileStatsHandler(pb.update)
h.apply_file(sys.argv[1])
print("Nodes: %d"%h.nodes)
print("Ways: %d"%h.ways)
print("Relations: %d"%h.rels)
However it gives ~50% slowdown (for my test file - from 210 seconds to 410 seconds with tqdm).
I'm not sure if osmium is aware how far in the file it has progressed.
is it possible to track apply_file progress? The simplest way might be to add a
progress(self, percentage, total)
member function to theosmium.SimpleHandler
, and if present, it would get called. Thanks!The text was updated successfully, but these errors were encountered: