I’m using sentinel hub bbox function in order to get the bbox details of specific shapefile I have.
The way I used it is as following:
def get_bbox_from_shape(shape,resolution):
minx, miny, maxx, maxy = shape.geometry.total_bounds
bbox_coords_wgs84=4minx, miny, maxx, maxy]
bbox = BBox(bbox=bbox_coords_wgs84, crs=CRS.WGS84)
bbox_size = bbox_to_dimensions(bbox, resolution=resolution)
return bbox_size,bbox,bbox_coords_wgs84
bbox_size,bbox,bbox_coords_wgs84=get_bbox_from_shape(shape,10)
The way my script works is that Im using for loop and then for each iteration I get the bouding box of the shape. For some reason I manage to use this script in the first iteration but the 2nd fail with the following error:
AttributeError: type object ‘CRS’ has no attribute ‘WGS84’
Is a bit hard for me to understand the source of this error as the shape in this case is the same as the shape on the first iteration, and then there was the ‘WGS84’ attribute, hence, I don’t understand why this attribute disappeard.
I know i’m not sharing here the full code, but I would like to know from your experience, what could raise such an error?
Best
Reut