fix for updating resource level coverage
@@ -28,7 +28,25 @@ def update_resource_coverage_element(resource):
'projection': 'WGS 84 EPSG:4326', 'units': "Decimal degrees"}
if len(spatial_coverages) > 1:
+ # check if one of the coverage is of type box
+ if any(sp_cov.type == 'box' for sp_cov in spatial_coverages):
cov_type = 'box'
+ else:
+ # check if the coverages represent different locations
+ unique_lats = set([sp_cov.value['north'] for sp_cov in spatial_coverages])
+ unique_lons = set([sp_cov.value['east'] for sp_cov in spatial_coverages])
+ if len(unique_lats) == 1 and len(unique_lons) == 1:
+ cov_type = 'point'
+ else:
+ cov_type = 'box'
+ if cov_type == 'point':
+ sp_cov = spatial_coverages[0]
+ bbox_value = dict()
+ bbox_value['projection'] = 'WGS 84 EPSG:4326'
+ bbox_value['units'] = 'Decimal degrees'
+ bbox_value['north'] = sp_cov.value['north']
+ bbox_value['east'] = sp_cov.value['east']
+ else:
for sp_cov in spatial_coverages:
if sp_cov.type == "box":
box_limits = bbox_limits['box']
