Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define and implement a no-bulk-download policy #16

Open
alexamici opened this issue Apr 2, 2016 · 5 comments
Open

Define and implement a no-bulk-download policy #16

alexamici opened this issue Apr 2, 2016 · 5 comments
Assignees
Milestone

Comments

@alexamici
Copy link
Member

Data providers have download policies and often require bulk download to be authenticated or limited. We don't intend to make too easy for users to make bulk downloads, instead we want to make the need for bulk download be minimised to case when it is really needed (off-the-internet machines, real time applications, etc).

Right now we refuse to clip or seed more that 9 tiles (even if they are already cached, which is dumb!).

Let's define and implement a better strategy.

@alexamici alexamici added this to the 1.0.0 milestone Apr 2, 2016
@alexamici alexamici added the bug label Apr 2, 2016
@alexamici alexamici self-assigned this Apr 2, 2016
@alexamici
Copy link
Member Author

Now that SRTM1 is sourced from Amazon this might not be a problem anymore. This needs to be re-evaluated.

@alexamici alexamici added enhancement and removed bug labels Sep 23, 2016
@alexamici
Copy link
Member Author

I received no complain about the current 9 tiles limitation so I'll move the issue to the next milestone.

@alexamici alexamici modified the milestones: 1.1.0, 1.0.0 Nov 3, 2016
@nickwg03
Copy link

nickwg03 commented Feb 7, 2017

@alexamici what would define a bulk-download? Is a bulk-download a download of the entire dataset, or would a large area also be defined as that? For downloading the entirety of India, the number of tiles is greater than 9, but I wouldn't think downloading for a single country would be a bulk-download.

So having some kind of method that would ensure we don't over-tax the server, but still allow downloads larger than 9 tiles at a time would be useful. Even just waiting a period of time before starting the next batch of 9, or something simple like that.

@tommylees112
Copy link

tommylees112 commented Jul 5, 2018

How can I download 12 tiles ( i need them for ethiopia ).

import elevation
import geopandas as gpd

world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
ethiopia = world.loc[world["name"] == "Ethiopia"]

bounds = ethiopia.bounds
west, south, east, north = bounds = bounds.values[0]

print(bounds)

[ 32.95418 3.42206 47.78942 14.95943]

output = data_dir + 'ethiopia.tif'
elevation.clip(bounds=bounds, output=output, product="SRTM3")
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-153-7f813bad82f0> in <module>()
      6 
      7 output = data_dir + 'ethiopia.tif'
----> 8 elevation.clip(bounds=bounds, output=output, product="SRTM3")

~/anaconda3/envs/crop_analysis/lib/python3.6/site-packages/elevation/datasource.py in clip(bounds, output, margin, **kwargs)
    171     """
    172     bounds = build_bounds(bounds, margin=margin)
--> 173     datasource_root = seed(bounds=bounds, **kwargs)
    174     do_clip(datasource_root, bounds, output, **kwargs)
    175 

~/anaconda3/envs/crop_analysis/lib/python3.6/site-packages/elevation/datasource.py in seed(cache_dir, product, bounds, max_download_tiles, **kwargs)
    144     if len(ensure_tiles_names) > max_download_tiles:
    145         raise RuntimeError("Too many tiles: %d. Please consult the providers' websites "
--> 146                            "for how to bulk download tiles." % len(ensure_tiles_names))
    147     ensure_tiles(datasource_root, ensure_tiles_names, **kwargs)
    148     util.check_call_make(datasource_root, targets=['all'])

RuntimeError: Too many tiles: 12. Please consult the providers' websites for how to bulk download tiles.

@lapp0
Copy link

lapp0 commented Feb 10, 2021

@tommylees112 I know you asked in 2018, but in case anyone else is coming across this and needs help:

    gen_bounds = elevation.datasource.build_bounds(bounds, margin='0')
    datasource_root = elevation.datasource.seed(bounds=gen_bounds, product='SRTM3', max_download_tiles=300)
    elevation.datasource.do_clip(datasource_root, gen_bounds, outfile_name)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants