Bbox list is empty

  • 26 April 2024
  • 3 replies
  • 2 views

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 = [info[‘index_x’] for info in info_list]
idxs_y = [info[‘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 = []
for idx, [bbox, info] in enumerate(zip(bbox_list, info_list)):
if (abs(info[‘index_x’] - info_list[ID][‘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


3 replies

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 @simone.vagnoni2,

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


Planet Monitoring
Investors

© 2024 Planet Labs PBC. All rights reserved.
| Privacy Policy | California Privacy Notice | California Do Not Sell
Your Privacy Choices | Cookie Notice | Terms of Use