Esempio n. 1
0
 def request7(self):
     wms_true_color_request = WmsRequest(data_folder='test_dir_tiff',
                                         layer='TRUE-COLOR',
                                         bbox=betsiboka_bbox,
                                         time=('2017-12-01', '2017-12-31'),
                                         width=512,
                                         height=856,
                                         image_format=MimeType.TIFF,
                                         config=config)
     wms_true_color_request.save_data()
     os.listdir(wms_true_color_request.data_folder)
Esempio n. 2
0
                                        width=width,
                                        maxcc=0.2,
                                        instance_id=INSTANCE_ID)

    wms_true_color_img = true_color_request.get_data()

    im = Image.fromarray(wms_true_color_img[-1])
    path =  "./" + str(name) + "/" + PATH_TYPE[type] 
    if (not os.path.isdir(path)):    
        os.makedirs(path)
    path = path + "/" + str(date) + ".png" 
    im.save(path, 'PNG')
    return path

#test
#downloadImage("NOME_SETTLEMENT",coord = [31.9, 36.58])

coords = [92.13, 21.218, 92.172, 21.18]

bbox = BBox(bbox=coords, crs=CRS.WGS84)

true_color_request = WmsRequest(layer=IMAGE_TYPE[2],
                                        bbox=bbox,
                                        data_folder='test_dir/up2/NDVI',
                                        time=("2012-01-01","2018-12-31"), 
                                        width=1920,
                                        maxcc=0.2,
                                        instance_id=INSTANCE_ID)

true_color_request.save_data()
    
        print(' - image %d was taken on %s' % (index, date))

    # see images one by one
    plot_image(wms_true_color_img[1])

    # Download raw bands of the selected image with 20m pixel size
    wms_bands_request = WmsRequest(data_folder='test_dir_tiff',
                                   layer='BANDS-S2-L1C',
                                   bbox=cauquenes_bbox,
                                   time='2017-12-10',
                                   width=1570, height=1600,
                                   image_format=MimeType.TIFF_d32f,
                                   instance_id=INSTANCE_ID,
                                   custom_url_params={CustomUrlParam.ATMFILTER: 'ATMCOR'})
    # save image to disk just in case
    wms_bands_img = wms_bands_request.save_data()
    # load aimage to python session
    wms_bands_img = wms_bands_request.get_data()
    # see image
    plot_image(wms_bands_img[-1])

    ########################################################
    ### Sentinel-2

    ### Sentinel-1 IW polyrization. Request RGB for visualizaation
    s1_request = WmsRequest(data_source=DataSource.SENTINEL1_IW,
                            layer='TRUE-COLOR-S1-IW',
                            bbox=cauquenes_bbox,
                            time=('2017-12-05', '2017-12-15'),
                            width=1190, height=1200,
                            instance_id=INSTANCE_ID)
        print(' - image %d was taken on %s' % (index, date))

    # see images one by one
    plot_image(wms_true_color_img[1])

    # Download raw bands of the selected image with 20m pixel size
    wms_bands_request = WmsRequest(data_folder='test_dir_tiff',
                                   layer='BANDS-S2-L1C',
                                   bbox=cauquenes_bbox,
                                   time='2017-12-10',
                                   width=1570, height=1600,
                                   image_format=MimeType.TIFF_d32f,
                                   instance_id=INSTANCE_ID,
                                   custom_url_params={CustomUrlParam.ATMFILTER: 'ATMCOR'})
    # save image to disk just in case
    wms_bands_img = wms_bands_request.save_data()
    # load aimage to python session
    wms_bands_img = wms_bands_request.get_data()
    # see image
    plot_image(wms_bands_img[-1])

    ########################################################
    ### Sentinel-2

    ### Sentinel-1 IW polyrization. Request RGB for visualizaation
    s1_request = WmsRequest(data_source=DataSource.SENTINEL1_IW,
                            layer='TRUE-COLOR-S1-IW',
                            bbox=cauquenes_bbox,
                            time=('2017-12-05', '2017-12-15'),
                            width=1190, height=1200,
                            instance_id=INSTANCE_ID)