def chunk(self):
chunk_size = utils.calc_chunk_size(self.area_in_sq_km)
chunks = self.chunk_n(chunk_size)
print('chunk size:', chunk_size)
files = []
for num, chunk in enumerate(chunks):
filename = self.chunk_filename(num, len(chunks))
# print(num, q.count(), len(tags), filename, list(tags))
full = os.path.join('overpass', filename)
files.append(full)
if os.path.exists(full):
continue
oql = self.oql_for_chunk(chunk, include_self=(num == 0))
r = overpass.run_query_persistent(oql)
if not r:
print(oql)
assert r
open(full, 'wb').write(r.content)
cmd = ['osmium', 'merge'] + files + ['-o', self.overpass_filename]
print(' '.join(cmd))
subprocess.run(cmd)
评论列表
文章目录