diff --git a/autotest/autotest/data/SCL/SCL_clipped.tif b/autotest/autotest/data/SCL/SCL_clipped.tif new file mode 100644 index 000000000..1ee374349 Binary files /dev/null and b/autotest/autotest/data/SCL/SCL_clipped.tif differ diff --git a/autotest/autotest/data/SCL/fixtures.json b/autotest/autotest/data/SCL/fixtures.json new file mode 100644 index 000000000..92f556dfc --- /dev/null +++ b/autotest/autotest/data/SCL/fixtures.json @@ -0,0 +1,376 @@ +[ +{ + "model": "coverages.fieldtype", + "pk": 1, + "fields": { + "coverage_type": 1, + "index": 0, + "identifier": "scl", + "description": "SCL", + "definition": "http://www.opengis.net/def/property/OGC/0/Radiance", + "unit_of_measure": "nil", + "wavelength": null, + "significant_figures": 2, + "numbits": 8, + "signed": false, + "is_float": false + } +}, +{ + "model": "coverages.allowedvaluerange", + "pk": 1, + "fields": { + "field_type": 1, + "start": 0.0, + "end": 11.0 + } +}, +{ + "model": "coverages.nilvalue", + "pk": 1, + "fields": { + "value": "0", + "reason": "http://www.opengis.net/def/nil/OGC/0/unknown", + "field_types": [ + 1 + ] + } +}, +{ + "model": "coverages.coveragetype", + "pk": 1, + "fields": { + "name": "SCL" + } +}, +{ + "model": "coverages.producttype", + "pk": 1, + "fields": { + "name": "SCL", + "allowed_coverage_types": [ + 1 + ] + } +}, +{ + "model": "coverages.browsetype", + "pk": 1, + "fields": { + "product_type": 1, + "name": "SCL", + "red_or_grey_expression": "scl", + "green_expression": null, + "blue_expression": null, + "alpha_expression": null, + "red_or_grey_nodata_value": null, + "green_nodata_value": null, + "blue_nodata_value": null, + "alpha_nodata_value": null, + "red_or_grey_range_min": null, + "green_range_min": null, + "blue_range_min": null, + "alpha_range_min": null, + "red_or_grey_range_max": null, + "green_range_max": null, + "blue_range_max": null, + "alpha_range_max": null, + "show_out_of_bounds_data": false + } +}, +{ + "model": "coverages.rasterstyle", + "pk": 1, + "fields": { + "name": "SCL", + "type": "values", + "title": null, + "abstract": null + } +}, +{ + "model": "coverages.rasterstyletobrowsetypethrough", + "pk": 1, + "fields": { + "raster_style": 1, + "browse_type": 1, + "style_name": "color" + } +}, +{ + "model": "coverages.rasterstylecolorentry", + "pk": 1, + "fields": { + "raster_style": 1, + "value": 0.0, + "color": "#000000", + "opacity": 1.0, + "label": "NO_DATA" + } +}, +{ + "model": "coverages.rasterstylecolorentry", + "pk": 2, + "fields": { + "raster_style": 1, + "value": 1.0, + "color": "#ff0000", + "opacity": 1.0, + "label": "SATURATED_OR_DEFECTIVE" + } +}, +{ + "model": "coverages.rasterstylecolorentry", + "pk": 3, + "fields": { + "raster_style": 1, + "value": 2.0, + "color": "#2e2e2e", + "opacity": 1.0, + "label": "DARK_AREA_PIXELS" + } +}, +{ + "model": "coverages.rasterstylecolorentry", + "pk": 4, + "fields": { + "raster_style": 1, + "value": 3.0, + "color": "#541800", + "opacity": 1.0, + "label": "CLOUD_SHADOWS" + } +}, +{ + "model": "coverages.rasterstylecolorentry", + "pk": 5, + "fields": { + "raster_style": 1, + "value": 4.0, + "color": "#46e800", + "opacity": 1.0, + "label": "VEGETATION" + } +}, +{ + "model": "coverages.rasterstylecolorentry", + "pk": 6, + "fields": { + "raster_style": 1, + "value": 5.0, + "color": "#ffff00", + "opacity": 1.0, + "label": "NOT_VEGETATED" + } +}, +{ + "model": "coverages.rasterstylecolorentry", + "pk": 7, + "fields": { + "raster_style": 1, + "value": 6.0, + "color": "#0000ff", + "opacity": 1.0, + "label": "WATER" + } +}, +{ + "model": "coverages.rasterstylecolorentry", + "pk": 8, + "fields": { + "raster_style": 1, + "value": 7.0, + "color": "#525252", + "opacity": 1.0, + "label": "UNCLASSIFIED" + } +}, +{ + "model": "coverages.rasterstylecolorentry", + "pk": 9, + "fields": { + "raster_style": 1, + "value": 8.0, + "color": "#787878", + "opacity": 1.0, + "label": "CLOUD_MEDIUM_PROBABILITY" + } +}, +{ + "model": "coverages.rasterstylecolorentry", + "pk": 10, + "fields": { + "raster_style": 1, + "value": 9.0, + "color": "#b5b5b5", + "opacity": 1.0, + "label": "CLOUD_HIGH_PROBABILITY" + } +}, +{ + "model": "coverages.rasterstylecolorentry", + "pk": 11, + "fields": { + "raster_style": 1, + "value": 10.0, + "color": "#00b6bf", + "opacity": 1.0, + "label": "THIN_CIRRUS" + } +}, +{ + "model": "coverages.rasterstylecolorentry", + "pk": 12, + "fields": { + "raster_style": 1, + "value": 11.0, + "color": "#da00f2", + "opacity": 1.0, + "label": "SNOW" + } +}, +{ + "model": "coverages.grid", + "pk": 1, + "fields": { + "name": null, + "coordinate_reference_system": "EPSG:32630", + "axis_1_name": "x", + "axis_2_name": "y", + "axis_3_name": null, + "axis_4_name": null, + "axis_1_type": 0, + "axis_2_type": 0, + "axis_3_type": null, + "axis_4_type": null, + "axis_1_offset": "200.0", + "axis_2_offset": "-200.0", + "axis_3_offset": null, + "axis_4_offset": null, + "resolution": 200 + } +}, +{ + "model": "coverages.eoobject", + "pk": 1, + "fields": { + "identifier": "S2B_30UUG_20221226_0_L2A", + "begin_time": null, + "end_time": null, + "footprint": "SRID=4326;POLYGON ((-6.1994886 55.9041676, -6.1207799 54.9190265, -4.4083987 54.9509423, -4.4439779 55.9372733, -6.1994886 55.9041676))", + "inserted": "2023-09-18T08:57:08.231Z", + "updated": "2023-09-18T11:44:34.789Z" + } +}, +{ + "model": "coverages.eoobject", + "pk": 2, + "fields": { + "identifier": "S2B_30UUG_20221226_0_L2A_scl", + "begin_time": null, + "end_time": null, + "footprint": "SRID=4326;POLYGON ((-6.120779882947349 54.919026538369536, -6.1994885612119175 55.904167624663266, -4.443977851096375 55.937273345275685, -4.40839870205061 54.95094226131747, -6.120779882947349 54.919026538369536))", + "inserted": "2023-09-18T08:57:08.757Z", + "updated": "2023-09-18T08:57:08.765Z" + } +}, +{ + "model": "coverages.product", + "pk": 1, + "fields": { + "product_type": 1, + "package": null, + "collections": [] + } +}, +{ + "model": "coverages.coverage", + "pk": 2, + "fields": { + "grid": 1, + "axis_1_origin": "300000.0", + "axis_2_origin": "6200040.0", + "axis_3_origin": null, + "axis_4_origin": null, + "axis_1_size": 549, + "axis_2_size": 549, + "axis_3_size": null, + "axis_4_size": null, + "coverage_type": 1, + "parent_product": 1, + "collections": [], + "mosaics": [] + } +}, +{ + "model": "coverages.arraydataitem", + "pk": 1, + "fields": { + "storage": null, + "location": "autotest/data/SCL/scl_small.tif", + "format": "image/tiff", + "coverage": 2, + "field_index": 0, + "band_count": 1, + "subdataset_type": null, + "subdataset_locator": null, + "bands_interpretation": 0 + } +}, +{ + "model": "coverages.productmetadata", + "pk": 1, + "fields": { + "product": 1, + "parent_identifier": null, + "production_status": null, + "acquisition_type": null, + "orbit_number": null, + "orbit_direction": null, + "track": null, + "frame": null, + "swath_identifier": null, + "product_version": null, + "product_quality_status": null, + "product_quality_degradation_tag": null, + "processor_name": null, + "processing_center": null, + "creation_date": null, + "modification_date": null, + "processing_date": null, + "sensor_mode": null, + "archiving_center": null, + "processing_mode": null, + "availability_time": null, + "acquisition_station": null, + "acquisition_sub_type": null, + "start_time_from_ascending_node": null, + "completion_time_from_ascending_node": null, + "illumination_azimuth_angle": null, + "illumination_zenith_angle": null, + "illumination_elevation_angle": null, + "polarisation_mode": null, + "polarization_channels": null, + "antenna_look_direction": null, + "minimum_incidence_angle": null, + "maximum_incidence_angle": null, + "across_track_incidence_angle": null, + "along_track_incidence_angle": null, + "doppler_frequency": null, + "incidence_angle_variation": null, + "cloud_cover": null, + "snow_cover": null, + "lowest_location": null, + "highest_location": null + } +}, +{ + "model": "services.servicevisibility", + "pk": 1, + "fields": { + "eo_object": 1, + "service": "wms", + "visibility": true + } +} +] diff --git a/autotest/autotest/data/SCL/scl_small.tif b/autotest/autotest/data/SCL/scl_small.tif new file mode 100644 index 000000000..bd349ccfc Binary files /dev/null and b/autotest/autotest/data/SCL/scl_small.tif differ diff --git a/autotest/autotest/data/SCL/setup_data.sh b/autotest/autotest/data/SCL/setup_data.sh new file mode 100755 index 000000000..2e27430d7 --- /dev/null +++ b/autotest/autotest/data/SCL/setup_data.sh @@ -0,0 +1,12 @@ +python3 manage.py coveragetype import autotest/data/SCL/scl_coverage_type.json +python3 manage.py producttype create SCL -c SCL +python3 manage.py browsetype create SCL SCL --grey scl + +python3 manage.py coveragetype import + +python3 manage.py rasterstyle import ./autotest/data/SCL/scl.sld --rename S2B_30UUG_20221226_0_L2A_scl SCL + +python3 manage.py rasterstyle link SCL SCL SCL color + +python3 manage.py product register -i S2B_30UUG_20221226_0_L2A -t SCL --footprint "POLYGON ((-6.1994886 55.9041676, -6.1207799 54.9190265, -4.4083987 54.9509423, -4.4439779 55.9372733, -6.1994886 55.9041676))" --replace +python3 manage.py coverage register -t SCL -r -d autotest/data/SCL/scl_small.tif --footprint-from-extent -i S2B_30UUG_20221226_0_L2A_scl -p S2B_30UUG_20221226_0_L2A \ No newline at end of file diff --git a/autotest/autotest/data/fixtures/scl_cloud_coverages.json b/autotest/autotest/data/fixtures/scl_cloud_coverages.json index e029f161a..66493fa89 100644 --- a/autotest/autotest/data/fixtures/scl_cloud_coverages.json +++ b/autotest/autotest/data/fixtures/scl_cloud_coverages.json @@ -62,7 +62,7 @@ "pk": 20, "fields": { "storage": null, - "location": "autotest/data/SCL_clipped.tif", + "location": "autotest/data/SCL/SCL_clipped.tif", "format": "image/tiff", "coverage": 20, "field_index": 0, diff --git a/autotest/autotest/data/fixtures/scl_styled.json b/autotest/autotest/data/fixtures/scl_styled.json new file mode 120000 index 000000000..a5d97c0f0 --- /dev/null +++ b/autotest/autotest/data/fixtures/scl_styled.json @@ -0,0 +1 @@ +../SCL/fixtures.json \ No newline at end of file diff --git a/autotest/autotest/expected/WMS13GetMapDatasetStyledTestCase.png b/autotest/autotest/expected/WMS13GetMapDatasetStyledTestCase.png new file mode 100644 index 000000000..36338a011 Binary files /dev/null and b/autotest/autotest/expected/WMS13GetMapDatasetStyledTestCase.png differ diff --git a/autotest/autotest_services/tests/wms/test_v13.py b/autotest/autotest_services/tests/wms/test_v13.py index 995406385..1031f2790 100644 --- a/autotest/autotest_services/tests/wms/test_v13.py +++ b/autotest/autotest_services/tests/wms/test_v13.py @@ -340,23 +340,23 @@ class WMS13GetMapCollectionMaskedOutlinesTestCase(wmsbase.WMS13GetMapTestCase): layers = ("MER_FRS_1P_reduced_products_RGB__outlines_masked_clouds",) bbox = (11, 32, 28, 46) -#=============================================================================== +# ============================================================================== # Styled Coverages -#=============================================================================== +# ============================================================================== -# currently disabled because of segfaults in MapServer -''' class WMS13GetMapDatasetStyledTestCase(wmsbase.WMS13GetMapTestCase): """ Test a GetMap request a dataset with an associated style. """ - fixtures = wmsbase.WMS13GetMapTestCase.fixtures + [ - "cryo_range_type.json", "cryo_coverages.json" - ] - - layers = ("FSC_0.0025deg_201303030930_201303031110_MOD_Alps_ENVEOV2.1.00",) - bbox = (6, 44.5, 16, 48) + fixtures = ["scl_styled.json"] + layers = ("S2B_30UUG_20221226_0_L2A__SCL",) + swap_axes = False + bbox = (294957.5887240702868, 6087495, 412022.3302920248825, 6202785) + crs = "EPSG:32630" width = 200 -''' + height = 200 + styles = ("color",) + frmt = "image/png" + #=============================================================================== # Feature Info #=============================================================================== @@ -420,3 +420,6 @@ def getRequest(self): def getFileExtension(self, file_type): return "png" + + +