From 0de1af4090cd88cfe55ecc08e4407f8eb9ff2ccb Mon Sep 17 00:00:00 2001 From: Lee Shepherd Date: Thu, 21 Feb 2013 12:25:00 -0800 Subject: [PATCH] add --tile-size argument to hillup-seed.py for making different size tiles (ex 512px for retina) --- Hillup/data/__init__.py | 4 ++-- hillup-seed.py | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) mode change 100644 => 100755 hillup-seed.py diff --git a/Hillup/data/__init__.py b/Hillup/data/__init__.py index 03ed049..6e15a09 100644 --- a/Hillup/data/__init__.py +++ b/Hillup/data/__init__.py @@ -39,12 +39,12 @@ class SeedingLayer (Layer): Intended for use in hillup-seed.py script for preparing a tile directory. """ - def __init__(self, demdir, tiledir, tmpdir, source): + def __init__(self, demdir, tiledir, tmpdir, source, size): """ """ cache = Disk(tiledir, dirs='safe') config = Configuration(cache, '.') - Layer.__init__(self, config, SphericalMercator(), Metatile()) + Layer.__init__(self, config, SphericalMercator(), Metatile(), tile_height=size) self.provider = Provider(self, demdir, tmpdir, source) diff --git a/hillup-seed.py b/hillup-seed.py old mode 100644 new mode 100755 index d91b360..3b90483 --- a/hillup-seed.py +++ b/hillup-seed.py @@ -20,7 +20,7 @@ See `%prog --help` for info.""") -defaults = dict(demdir='source', tiledir='out', tmpdir=None, source='worldwide', bbox=(37.777, -122.352, 37.839, -122.086)) +defaults = dict(demdir='source', tiledir='out', tmpdir=None, source='worldwide', bbox=(37.777, -122.352, 37.839, -122.086), size=256) parser.set_defaults(**defaults) @@ -43,6 +43,9 @@ parser.add_option('--tmp-directory', dest='tmpdir', help='Optional working directory for temporary files. Consider a ram disk for this.') +parser.add_option('--tile-size', dest='size', type='int', + help='Optional size for rendered tiles, default %(size)s.' % defaults) + def generateCoordinates(ul, lr, zooms, padding): """ Generate a stream of (offset, count, coordinate) tuples for seeding. """ @@ -108,7 +111,7 @@ def generateCoordinates(ul, lr, zooms, padding): tiles = generateCoordinates(ul, lr, zooms, 0) - layer = SeedingLayer(options.demdir, options.tiledir, options.tmpdir, options.source) + layer = SeedingLayer(options.demdir, options.tiledir, options.tmpdir, options.source, options.size) for (offset, count, coord) in tiles: