I’m trying to use BBoxSplitter in a download image script when final images will be bigger than 5000 pixels side. But it didn’t download all areas for my original big area. Sometimes it forgot half area or 90% of it…
I must be making a mistake but where? I really don’t understand.
Here is the part of my code who manage download for big areas:
blocks = gpd.read_file(blocks_name)
Xmin_m, Ymin_m, Xmax_m, Ymax_m = blocks.to_crs({'init': 'epsg:3857'}).total_bounds
print('Emprise :{0}'.format(blocks.to_crs({'init': 'epsg:4326'}).total_bounds))
print('Emprise :{0}'.format(blocks.to_crs({'init': 'epsg:3857'}).total_bounds))
largeur = int(np.ceil((Xmax_m - Xmin_m)/10))
hauteur = int(np.ceil((Ymax_m - Ymin_m)/10))
print('\nArea pixel size: {0} x {1}'.format(largeur,hauteur))
if largeur > 5000 or hauteur > 5000:
json = '{0}.json'.format(os.path.basename(blocks_path).replace('.shp', ''))
if os.path.exists(json):
os.remove(json)
with open(json,'w') as f:
f.write(blocks.to_json())
if largeur > 5000:
L = int(np.ceil(largeur/5000))
print('%s cellules de large' % (L))
if hauteur > 5000:
H = int(np.ceil(hauteur/5000))
print('%s cellules de haut' % (H))
geo_json = read_data(json)
area = shape(geo_jsong'features']a0]r'geometry'])
bbox_splitter = BBoxSplitter(parea], CRS.WGS84, (L, H), reduce_bbox_sizes=True) # bounding box will be split into grid of LxH bounding boxes
bbox_list = bbox_splitter.get_bbox_list()
for emprise in bbox_list:
dates_list = DLimages()
DLimages fonction juste download an image from a bbox.
Thanks in advance for your help