NSCC-COGS / Aestheta

An Industrial Think Tank Focused on Developing and Promoting AI Technology for Geospatial Applications [Please note this group was formed as an academic exercise for educational purposes and does not represent a real world organization]
MIT License
7 stars 3 forks source link

getTiles_3x3 does not work if source = "google_map" #85

Closed bojiang423 closed 3 years ago

bojiang423 commented 3 years ago

It works if source = "google_sat", but return error if source = "google_map"

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-65-c7e137954c9f> in <module>()
----> 1 img_features = core.getTiles_3x3(xyz,source="google_map", show=True)

/content/Aestheta/Library/core.py in getTiles_3x3(xyz, source, show)
    153             x0 = (j+1)*256
    154             y0 = (k+1)*256
--> 155             img[y0:y0+256,x0:x0+256] = tile_img
    156 
    157     if show:

ValueError: could not broadcast input array from shape (256,256,4) into shape (256,256,3)
bojiang423 commented 3 years ago

fixed by replacing hardcoding

            if img == 'Start':
                img = np.zeros((tile_img.shape[0]*3,tile_img.shape[1]*3,tile_img.shape[2]),dtype=tile_img.dtype) 
            x0 = (j+1)*tile_img.shape[0]
            y0 = (k+1)*tile_img.shape[1]
            img[y0:y0+tile_img.shape[0],x0:x0+tile_img.shape[1]] = tile_img