@@ -32,23 +32,29 @@ def class_match(ml_type, label, i):
32
32
def download_tile_tms (tile , imagery , folder , kwargs ):
33
33
"""Download a satellite image tile from a tms endpoint"""
34
34
o = urlparse (imagery )
35
- #_, image_format = op.splitext(o.path)
36
- image_format = '.jpg'
35
+ _ , image_format = op .splitext (o .path )
37
36
tile_img = op .join (folder , '{}{}' .format (tile , image_format ))
38
37
tile = tile .split ('-' )
39
38
40
39
41
- over_zoom = kwargs .get ('imagery_offset ' ) or 0
42
-
40
+ over_zoom = kwargs .get ('over_zoom ' ) or 0
41
+ new_zoom = over_zoom + kwargs . get ( 'zoom' )
43
42
if over_zoom :
44
43
#get children
45
- child_tiles = children (int (tile [0 ]), int (tile [1 ]), int (tile [2 ]))
44
+ child_tiles = children (int (tile [0 ]), int (tile [1 ]), int (tile [2 ]), zoom = new_zoom )
46
45
child_tiles .sort ()
47
46
48
- w_lst = [Window (0 , 0 , 256 , 256 ), Window (0 , 256 , 256 , 256 ), Window (256 , 0 , 256 , 256 ), Window (256 , 256 , 256 , 256 )]
47
+ new_dim = 256 * (2 * over_zoom )
48
+
49
+ w_lst = []
50
+ for i in range (2 * over_zoom ):
51
+ for j in range (2 * over_zoom ):
52
+ window = Window (i * 256 , j * 256 , 256 , 256 )
53
+ w_lst .append (window )
54
+
49
55
#request children
50
- with rasterio .open (tile_img , 'w' , driver = 'jpeg' , height = 512 ,
51
- width = 512 , count = 3 , dtype = rasterio .uint8 ) as w :
56
+ with rasterio .open (tile_img , 'w' , driver = 'jpeg' , height = new_dim ,
57
+ width = new_dim , count = 3 , dtype = rasterio .uint8 ) as w :
52
58
for num , t in enumerate (child_tiles ):
53
59
print (t )
54
60
t = [str (t [0 ]), str (t [1 ]), str (t [2 ])]
0 commit comments