def process_item(out, min_cache_zoom, cache, link,
part_zoom, tiled_countries, all_countries,
min_zoom, max_zoom, skip_empty_tiles):
stat = Stat()
date = get_date_from_link(link)
for line in lzma.LZMAFile(get_tile_usage_dump(link)):
path, count = line.decode().strip().split()
z, x, y = path.split('/')
x = int(x)
y = int(y)
z = int(z)
if min_zoom is not None and z < min_zoom:
continue
if max_zoom is not None and z > max_zoom:
continue
twest, tsouth, teast, tnorth = b = mercantile.bounds(x, y, z)
country = detect_country_with_cache(
path, b, x, y, z, part_zoom, tiled_countries, all_countries,
min_cache_zoom, cache, stat)
if skip_empty_tiles and country == '??':
continue
lat = tnorth + (tnorth - tsouth) / 2
lon = twest + (teast - twest) / 2
out.write(('%s,%s,%s,%s,%s,%s,%s,%s\n' % (
date, z, x, y, count, lat, lon, country)).encode())
stat.log_stats(date, cache)
Fetch2.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录