Skip to content

Commit

Permalink
Enforce the no-bulk-download policy.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexamici committed Mar 31, 2016
1 parent 3861a19 commit 9c7afe5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions elevation/datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,13 @@ def do_clip(path, bounds, output, **kwargs):
return util.check_call_make(path, targets=['clip'], variables=variables_items, **kwargs)


def seed(cache_dir=CACHE_DIR, product=DEFAULT_PRODUCT, bounds=None, **kwargs):
def seed(cache_dir=CACHE_DIR, product=DEFAULT_PRODUCT, bounds=None, max_donwload_tiles=9, **kwargs):
datasource_root, spec = ensure_setup(cache_dir, product)
ensure_tiles_names = spec['tile_names'](*bounds)
ensure_tiles_names = list(spec['tile_names'](*bounds))
# FIXME: emergency hack to enforce the no-bulk-download policy
if len(ensure_tiles_names) > max_donwload_tiles:
raise RuntimeError("Too many tiles: %d. Please consult the providers' websites "
"for bulk download." % len(ensure_tiles_names))
ensure_tiles(datasource_root, ensure_tiles_names, **kwargs)
util.check_call_make(datasource_root, targets=['all'])
return datasource_root
Expand Down

0 comments on commit 9c7afe5

Please sign in to comment.