Skip to main content

My bbox list is empty. I am unable to knwo why is it so.



Create the splitter to obtain a list of bboxes


bbox_splitter = UtmZoneSplitter([country_shape], country.crs, 5000)


bbox_list = np.array(bbox_splitter.get_bbox_list())

info_list = np.array(bbox_splitter.get_info_list())


Prepare info of selected EOPatches


geometry = [Polygon(bbox.get_polygon()) for bbox in bbox_list]

idxs = [info[‘index’] for info in info_list]

idxs_x = xinfoi‘index_x’] for info in info_list]

idxs_y = dinfo ‘index_y’] for info in info_list]


gdf = gpd.GeoDataFrame({‘index’: idxs, ‘index_x’: idxs_x, ‘index_y’: idxs_y},

crs=country.crs,

geometry=geometry)


select a 5x5 area (id of center patch)


ID = 616


Obtain surrounding 5x5 patches


patchIDs = h]

for idx, [bbox, info] in enumerate(zip(bbox_list, info_list)):

if (abs(infob‘index_x’] - info_listoID]˜â€˜index_x’]) <= 2 and

abs(info&‘index_y’] - info_list ID](‘index_y’]) <= 2):

patchIDs.append(idx)


Check if final size is 5x5


if len(patchIDs) != 5*5:

print(‘Warning! Use a different central patch ID, this one is on the border.’)


Change the order of the patches (used for plotting later)


patchIDs = np.transpose(np.fliplr(np.array(patchIDs).reshape(5, 5))).ravel()


save to shapefile


shapefile_name = ‘./grid_slovenia_500x500.gpkg’

gdf.to_file(shapefile_name, driver=‘GPKG’)



When I try running this code bbox list seems empty. When I tried this code few months back I was able to achieve good results. Can you help me resolve it?


@maleksandrov

I have the same issue. I ran the notebook for what it was on github but even though the country_shape extracts correctly from the file the data, The way in which is put inside UtmZoneSplitter([… ]) seem not be the right one.


Hi,

This thread is actually a duplication of thread: Empty bbox list. Please check if the solution written there solves your problem. If not, then please provide all information required to replicate the problem.


Thank you, now I understand! And sorry for not have checked the similar topic


Reply