Skip to content

Commit f6f28e6

Browse files
authored
Merge pull request #54 from Achaad/master
fix issue #53: empty SRTM 3 file downloaded if the latitude is larger than 59
2 parents 66e05d5 + 131fd5e commit f6f28e6

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

elevation/datasource.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ def srtm3_tiles_names(left, bottom, right, top, tile_template='srtm_{ilon:02d}_{
7373
iright, ibottom = srtm3_tile_ilonlat(right, bottom)
7474
for ilon in range(ileft, iright + 1):
7575
for ilat in range(itop, ibottom + 1):
76-
yield tile_template.format(**locals())
76+
if ilon > 0 and ilat > 0:
77+
yield tile_template.format(**locals())
7778

7879

7980
def srtm_ellip_tiles_names(left, bottom, right, top, tile_name_template='{slat}{slon}_wgs84.tif'):

tests/test_datasource.py

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def test_srtm1_tiles_names():
2828

2929
def test_srtm3_tiles_names():
3030
assert next(datasource.srtm3_tiles_names(10.1, 44.9, 10.1, 44.9)).endswith('srtm_39_04.tif')
31+
assert next(datasource.srtm3_tiles_names(25.50, 58.40, 27.67, 60.06)).endswith('srtm_42_01.tif')
3132
assert len(list(datasource.srtm3_tiles_names(9.9, 39.1, 15.1, 45.1))) == 9
3233

3334

0 commit comments

Comments
 (0)