editor-layer-index icon indicating copy to clipboard operation
editor-layer-index copied to clipboard

Allow URL to be an object

Open andrewharvey opened this issue 8 months ago • 3 comments

As I realised in #2626 the ESRI service URLs can be quite complex, we should consider extending the schema so the URL can be provided as an object which would then be assembled by the build into the current output.

This makes it much easier for humans to create, review and modify the URL.

before

"url": "https://portal.spatial.nsw.gov.au/server/rest/services/StrataHub/MapServer/export?layers=show%3A0&imageSR={wkid}&bbox={bbox}&bboxSR={wkid}&format=png32&size={width},{height}&transparent=true&f=image&dynamicLayers=%5B%0D%0A%7B%0D%0A%22id%22%3A0%2C%0D%0A%22source%22%3A%7B%0D%0A%22type%22%3A%22mapLayer%22%2C%0D%0A%22mapLayerId%22%3A0%0D%0A%7D%2C%0D%0A%22drawingInfo%22%3A%7B%0D%0A%22renderer%22%3A%7B%0D%0A%22type%22%3A%22simple%22%2C%0D%0A%22symbol%22%3A%7B%0D%0A%22type%22%3A%22esriSFS%22%2C%0D%0A%22style%22%3A%22esriSFSSolid%22%2C%0D%0A%22color%22%3A%5B201%2C242%2C252%2C128%5D%2C%0D%0A%22outline%22%3A%7B%0D%0A%22type%22%3A%22esriSLS%22%2C%0D%0A%22style%22%3A%22esriSLSolid%22%2C%0D%0A%22color%22%3A%5B110%2C110%2C110%2C255%5D%2C%0D%0A%22width%22%3A1%0D%0A%7D%0D%0A%7D%0D%0A%7D%0D%0A%7D%0D%0A%7D%0D%0A%5D%0D%0A",

after

{
  url: "https://portal.spatial.nsw.gov.au/server/rest/services/StrataHub/MapServer/export",
  searchParams: {
    layers: "show:0",
    imageSR: "{wkid}",
    bbox: "{bbox}",
    bboxSR: "{wkid}",
    format: "png32",
    size: "{width},{height}",
    transparent: "true",
    f: "image",
    dynamicLayers: [
      {
        "id": 0,
        "source": {
          "type": "mapLayer",
          "mapLayerId": 0
        },
        "drawingInfo": {
          "renderer": {
            "type": "simple",
            "symbol": {
              "type": "esriSFS",
              "style": "esriSFSSolid",
              "color": [
                201,
                242,
                252,
                128
              ],
              "outline": {
                "type": "esriSLS",
                "style": "esriSLSolid",
                "color": [
                  110,
                  110,
                  110,
                  255
                ],
                "width": 0
              }
            }
          }
        }
      }
    ]
  }
}

andrewharvey avatar Feb 12 '25 04:02 andrewharvey