Skip to content

Commit

Permalink
add --tile-size argument to hillup-seed.py for making different size …
Browse files Browse the repository at this point in the history
…tiles (ex 512px for retina)
  • Loading branch information
bwg committed Feb 21, 2013
1 parent 9493210 commit 0de1af4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Hillup/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
7 changes: 5 additions & 2 deletions hillup-seed.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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.
"""
Expand Down Expand Up @@ -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:

Expand Down

0 comments on commit 0de1af4

Please sign in to comment.