Skip to content

Commit

Permalink
Special case often used integer top and right to avoid downloading un…
Browse files Browse the repository at this point in the history
…needed tiles.
  • Loading branch information
alexamici committed Mar 24, 2016
1 parent 267be0b commit d6b6cf2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions elevation/datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ def srtm3_tile_ilonlat(lon, lat):
def srtmgl1_tiles_names(left, bottom, right, top, tile_name_template='{slat}{slon}.tif'):
ileft, itop = srtmgl1_tile_ilonlat(left, top)
iright, ibottom = srtmgl1_tile_ilonlat(right, bottom)
# special case often used *integer* top and right to avoid downloading unneeded tiles
if top.is_integer():
itop -= 1
if right.is_integer():
iright -= 1
for ilon in range(ileft, iright + 1):
slon = '%s%03d' % ('E' if ilon >= 0 else 'W', abs(ilon))
for ilat in range(ibottom, itop + 1):
Expand Down

0 comments on commit d6b6cf2

Please sign in to comment.