summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-11-15 18:05:13 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-11-15 18:05:13 (GMT)
commitcf096489feaea2a975157e7989d844a9296fab56 (patch)
tree6b96f98de7cb56f890afb8ea96a107c72614f7f5
parentab58a6293e2929d64f97aaf857e5c6f6183ebbc1 (diff)
Sane defaults, less debug output. Add zoom/tile levels option.
-rw-r--r--tools/natural-earth-vector-tiling/ne_tilegenerator.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/natural-earth-vector-tiling/ne_tilegenerator.py b/tools/natural-earth-vector-tiling/ne_tilegenerator.py
index 105d49b..908c313 100644
--- a/tools/natural-earth-vector-tiling/ne_tilegenerator.py
+++ b/tools/natural-earth-vector-tiling/ne_tilegenerator.py
@@ -103,9 +103,10 @@ def check_existence(filename, in_dir):
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Generates low level tiles for Marble using Natural Earth data')
- parser.add_argument('file', help='a file with information containing natural datasets for specific levels.')
+ parser.add_argument('-f', '--file', help='a file with information containing natural datasets for specific levels.', default='level_info.txt')
parser.add_argument('-i', '--in_dir', help='directory to read/process data from', default='.')
- parser.add_argument('-o', '--out_dir', help='directory to write tiles to', default='.')
+ parser.add_argument('-z', '--zoom', help='Tile levels to process', default='')
+ parser.add_argument('-o', '--out_dir', help='directory to write tiles to', default=os.path.join(os.path.expanduser("~"), '.local', 'share', 'marble', 'maps', 'earth', 'vectorosm'))
parser.add_argument('-c', '--cache', help='directory to store intermediate files in', default='.')
parser.add_argument('-r', '--refresh', type=int, default=-1, help='Re-download cached OSM base file if it is older than REFRESH days (-1: do not re-download)')
parser.add_argument('-ow', '--overwrite', action='store_true', help='Create tiles even if they exist already')
@@ -116,9 +117,10 @@ if __name__ == "__main__":
level_info = parse_file(args.file, args.in_dir)
for level in level_info:
+ if not args.zoom or str(level) not in args.zoom:
+ continue
abs_file_paths = []
for filename in level_info[level]:
- print('Checking - {}'.format(filename))
check_existence(filename, args.in_dir)
if filename == 'ne_10m_parks_and_protected_lands':
path = os.path.join(args.in_dir, filename) + '/' + filename + '_area.shp'
@@ -127,7 +129,6 @@ if __name__ == "__main__":
else:
path = os.path.join(args.in_dir, filename) + '/' + filename + '_shp.shp'
abs_file_paths.append(path)
- print('Level has following SHP datasets: ', abs_file_paths)
target = 'tiny_planet_{}.1.osm'.format(level)
if args.overwrite or not os.path.exists(target):
polyshp2osm.run(abs_file_paths, 1, 5000000, 'tiny_planet_{}'.format(level), no_source=True)