@@ -40,6 +40,7 @@ def download_tile_tms(tile, imagery, folder, kwargs):
40
40
over_zoom = kwargs .get ('over_zoom' ) or 0
41
41
new_zoom = over_zoom + kwargs .get ('zoom' )
42
42
if over_zoom :
43
+ print ('creating supertiles' )
43
44
#get children
44
45
child_tiles = children (int (tile [0 ]), int (tile [1 ]), int (tile [2 ]), zoom = new_zoom )
45
46
child_tiles .sort ()
@@ -56,13 +57,14 @@ def download_tile_tms(tile, imagery, folder, kwargs):
56
57
with rasterio .open (tile_img , 'w' , driver = 'jpeg' , height = new_dim ,
57
58
width = new_dim , count = 3 , dtype = rasterio .uint8 ) as w :
58
59
for num , t in enumerate (child_tiles ):
59
- print (t )
60
60
t = [str (t [0 ]), str (t [1 ]), str (t [2 ])]
61
- #print(t)
62
61
r = requests .get (url (t , imagery ),
63
62
auth = kwargs .get ('http_auth' ))
64
63
img = np .array (Image .open (io .BytesIO (r .content )), dtype = np .uint8 )
65
- img = img .reshape ((256 , 256 , 4 )) #4 channels returned from some endpoints, but not all
64
+ try :
65
+ img = img .reshape ((256 , 256 , 3 )) #4 channels returned from some endpoints, but not all
66
+ except ValueError :
67
+ img = img .reshape ((256 , 256 , 4 ))
66
68
img = img [:, :, :3 ]
67
69
img = np .rollaxis (img , 2 , 0 )
68
70
w .write (img , window = w_lst [num ])
0 commit comments