geobeyond / Arpav-PPCV-backend

Backend di Piattaforma Proiezioni Climatiche per il Nord-Est.
Creative Commons Attribution 4.0 International
0 stars 1 forks source link

Add property to coverage configuration to specify main wms layer name #142

Closed ricardogsilva closed 3 months ago

ricardogsilva commented 3 months ago

This PR adds both:

  1. a new property to coverage configurations that holds the name of the main WMS layer for the respective service. This shall enable the frontend to know the name of the WMS layer to use in its map viewer.

    So a request like this:

    http localhost:8877/api/v2/coverages/coverage-configurations/50fd58e1-3dd3-447a-be39-094b4830db9a

    The response now includes the wms_main_layer_name property:

    {
        "allowed_coverage_identifiers": [
            "fd_annual_absolute_model_mpi_esm_lr_remo2009-rcp26",
            "fd_annual_absolute_model_mpi_esm_lr_remo2009-rcp45",
            "fd_annual_absolute_model_mpi_esm_lr_remo2009-rcp85"
        ],
        "color_scale_max": 200.0,
        "color_scale_min": 0.0,
        "coverage_id_pattern": "{name}-{scenario}",
        "id": "50fd58e1-3dd3-447a-be39-094b4830db9a",
        "name": "fd_annual_absolute_model_mpi_esm_lr_remo2009",
        "palette": "default/seq-Blues-inv",
        "possible_values": [
            {
                "configuration_parameter_name": "scenario",
                "configuration_parameter_value": "rcp26"
            },
            {
                "configuration_parameter_name": "scenario",
                "configuration_parameter_value": "rcp45"
            },
            {
                "configuration_parameter_name": "scenario",
                "configuration_parameter_value": "rcp85"
            }
        ],
        "unit": "gg",
        "url": "http://localhost:8877/api/v2/coverages/coverage-configurations/50fd58e1-3dd3-447a-be39-094b4830db9a",
        "wms_main_layer_name": "fd"
    }
  2. A more fleshed out payload as the response to the new /api/v2/coverages/coverage-identifiers endpoint. Instead of a simple list of strings, this will now show the base WMS URL, the name of the main WMS layer and a URL to the related coverage configuration detail API endpoint:

    So a request like this:

    http://localhost:8877/api/v2/coverages/coverage-identifiers?
        name_contains=tas_&
        name_contains=rcp26&
        name_contains=djf&
        name_contains=absolute&
        name_contains=ensemble

    outputs a response like:

    {
      "items": [
        {
          "identifier": "tas_seasonal_absolute_model_ensemble-rcp26-DJF",
          "related_coverage_configuration_url": "http://localhost:8877/api/v2/coverages/coverage-configurations/086b3634-edfa-4c57-8691-465ec47aaaa3",
          "wms_base_url": "http://thredds:8080/thredds/wms/ensymbc/clipped/tas_avg_rcp26_DJF_ts19762100_ls_VFVG.nc",
          "wms_main_layer_name": "tas"
        },
        {
          "identifier": "tas_seasonal_absolute_model_ensemble_lower_uncertainty-rcp26-DJF",
          "related_coverage_configuration_url": "http://localhost:8877/api/v2/coverages/coverage-configurations/246b1647-08b9-4af4-bce8-5b8369f67ffa",
          "wms_base_url": "http://thredds:8080/thredds/wms/ensymbc/std/clipped/tas_stddown_rcp26_DJF_ts19762100_ls_VFVG.nc",
          "wms_main_layer_name": "tas_stddown"
        },
        {
          "identifier": "tas_seasonal_absolute_model_ensemble_upper_uncertainty-rcp26-DJF",
          "related_coverage_configuration_url": "http://localhost:8877/api/v2/coverages/coverage-configurations/1905ec75-d0be-4c2c-a381-3a6956d3a638",
          "wms_base_url": "http://thredds:8080/thredds/wms/ensymbc/std/clipped/tas_stdup_rcp26_DJF_ts19762100_ls_VFVG.nc",
          "wms_main_layer_name": "tas_stdup"
        }
      ],
      "meta": {
        "returned_records": 3,
        "total_records": 1776,
        "total_filtered_records": 3
      },
      "links": {
        "self": "http://localhost:8877/api/v2/coverages/coverage-identifiers?limit=20&offset=0&name_contains=ensemble",
        "next": null,
        "previous": null,
        "first": "http://localhost:8877/api/v2/coverages/coverage-identifiers?limit=20&offset=0&name_contains=ensemble",
        "last": "http://localhost:8877/api/v2/coverages/coverage-identifiers?limit=20&offset=0&name_contains=ensemble"
      }
    }

Lastly, this PR also adds the bootstrap configurations so that this new WMS layer name property is configured when bootstrapping the system