fgpv-vpgf / fgpv-vpgf

The Reusable Accessible Mapping Platform (RAMP), also known as the Federal Geospatial Platform Visualiser (FGPV), is a Javascript based web mapping platform that provides a reusable, responsive and WCAG 2.0 "AA" compliant common viewer platform for the Government of Canada.
https://fgpv-vpgf.github.io/fgpv-vpgf/master/docs/#/
Other
45 stars 48 forks source link

RAMP load times #4089

Closed prosperva closed 1 year ago

prosperva commented 1 year ago

I have a map based off RAMP, with layers that have date parameters. Is there a way to only load the layers and not the whole map which includes basemaps?

james-rae commented 1 year ago

There is not a lot of time support built in. But if you provide more information I can attempt to give a better answer. Where are your layers hosted? How are you adding the layers to RAMP? FeatureLayer? DynamicLayer? If the map server has a public URL that might help as well.

prosperva commented 1 year ago

Layers are hosted on an NRCan public server. I add layers using a config file. Layers are esriFeature and ogcWms types.

I was thinking of keeping an instance of RAMP on the first time, then re-using it.

james-rae commented 1 year ago

I'm still rather confused what you're attempting to do, but I did revisit the codebase and there's even less support for time slicing than I thought. So in short, if you have a layer with a "time/date" dimension (i.e. multiple time slices of a the dataset contained in a single layer), there is very little out-of-the-box support in RAMP. Was something we put in our backlog in 2015 and it never got the priority push to make it out.

There is some hack tricks you can attempt by digging through properties in API objects to assign visual filters, but even that approach has very bad performance impacts (as an example, opening the datagrid will download ALL the features to the client, then filter on the given time...very lousy).

prosperva commented 1 year ago

With config below, I am using this json endpoint: https://cwfis.cfs.nrcan.gc.ca/geoserver/public/ows?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&typeName=public:hotspots_2022&LAYERS=public:hotspots_2022&STYLES=cwfis_hotspots_last24hrs&outputFormat=application%2Fjson&cql_filter=rep_date%20between%20%272022-08-11T00:00:00Z%27%20and%20%272022-08-11T23:59:59Z%27. And in this particular endpoint, there is a date parameter. On first load of the map, a basemap is added and the layer is also added. I am also allowing users to change the date using a date picker so they can see changes in the dataset.

My question is if RAMP allows to reload the layer only without reloading the basemap?

{
  "map": {
    "components": {
      "geoSearch": { "enabled": true, "showGraphic": true, "showInfo": true },
      "mouseInfo": {
        "enabled": true,
        "spatialReference": {
          "wkid": 4326,
          "vcsWkid": null,
          "latestWkid": null,
          "latestVcsWkid": null,
          "wkt": ""
        }
      },
      "northArrow": {
        "enabled": true,
        "arrowIcon": "",
        "poleIcon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAKsGlDQ1BJQ0MgUHJvZmlsZQAASImVlgdQU+kWx7970xstgHRCb4J0AkgJPYCCdBCVkEAIJcaE0OzKogIriooIKCu6VAXXAshiQxQLi4AiWBdkUVHWxYKoqLwLPMJ7b97Om3dmTr7f/Ofcc//fl/vNHADIj1kCQTIsA0AKP1UY5O1Gi4iMouGeAQhgAAWoAhqLLRIwAgP9wd/Gx/tINRJ3TWd6/X3dfw1ZTpyIDQAUiHAsR8ROQfgskm1sgTAVAFQGouukpwpmuAxheSFiEOFTM8yd4/YZjp3jgdmakCB3hMcAwJNZLCEXANInRKelsblIH7ISwuZ8Do+PsA/CzuwEFgfhnQgvTklZO8OIB2AY+y99uP/WM1bSk8XiSnhuL7OB9+CJBMmszP/zOP53pCSL59+hjSQ5QegThKwqyJlVJ631kzA/dnnAPPM4s/WznCD2CZ1ntsg9ap45LA+/eRYnhTLmmSVceJaXygyZZ+HaIEn/OJFnsKR/HNNf4iF5uYTjeV7Mec5KCAmf5zRe2PJ5FiUF+y3UuEt0oThI4jle6CXZY4powRubteAhNSHEZ8FbhMQDJ87DU6LzQyX1glQ3SU9BcqCkPi7ZW6KL0oIlz6YiH9g8J7J8Axf6BErOBwSCBMADyUgKgAjQgCWwBubADSA7T43LSJ0x7r5WkCnkcRNSaQzk5sTRmHy22WKapbkFHYCZezj3N78fmL1fkCJ+QTt0BgC/E4i4c0GzawCg3Br5/AcWND3khBQ0AWjtZIuFaXMaeuYHA4hAGsgDZaABdIAhMEX82QJH4Ao8gS8IACEgEqwGbGQPKUAI0sEGsBXkgDywBxwAJaAcHAPV4CQ4DZpAK7gCroPboBv0gUdg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MPEpBQYHU19dTRkfOZGpqSjY3N2FnOnf2YSeIvYPeFmYeQE21A0ZJYWGhgMpCQ0BxxTiEyz6Z7QZWHSCUsJXv7+/TMiaTyU5hXQ8FQ1p5RbnyABSHV+n7xxClc5n2AuOMOw4QmkNikCnz8/NyenpqwcoEcuG5vr6Wre2tRPQw6iYwQ1VbW6u8iR5EJRqN8qyGq0A16sdBThB6AvoSKAXlRkdHhwes+gc0rYWFbtyDBJKs4w4Ya2trAkYJqX95eWnhwsZqamoCH6ARAJ2WE4SbAEm1t7cbuJxHABpva2v7BuBPkZ/nyMnT5eVl2djYiMM7xMuCB4aVn5/v6u/vD4AQ5/jeUA9kzJwgcNdkeBDzYwC9wPh3HkCbx/c9atpXoG0/PPx0d3dXhRd1TLB2BSr/gPEYStFf4+Pjrr6+vqQD5DZUJikKCk8TgMK9vb2p0dFRFlELBfJbhO9HAAxA8TXyYCEsflzaf3F/fqU1CCsvtnqPHCAUIBAvJGqLj3NaQ7bY7wdqlwfUPcbWMPfvNxbErq4uMjF34rlB5WwEAp0dnOce8hMnKN4eFwsg1+ApOwvnMheGC2xZnuBgCAyiF44XLS1+94cyKncovJO4G6lKyaeUS7hYf6IeXYGSfnKdNLYbPXvfpkAYaz5cLS0tPwMkAoZoLBMAyhmux4IpEB5CyVYKwZQAwqZyAk+ywvlY5ba8Q0lDQ4OFZKKch6WsrCzjiQ1sH3xM7wg0yvWHeBNCLON4ES9wqTYfozCX7P/UTUtHBBtR/gAAAABJRU5ErkJggg=="
      },
      "basemap": { "enabled": true },
      "overviewMap": {
        "enabled": true,
        "expandFactor": 4,
        "initiallyExpanded": true
      },
      "scaleBar": { "enabled": true }
    },
    "initialBasemapId": "f7f9f166",
    "extentSets": [
      {
        "id": "EXT_NRCAN_Lambert_3978",
        "default": {
          "xmin": -4844430.556896179,
          "ymin": -1052774.037634491,
          "xmax": 5666163.380958509,
          "ymax": 4170111.408136484
        },
        "full": {
          "xmax": 5666163.380958509,
          "xmin": -4844430.556896179,
          "ymax": 4170111.408136484,
          "ymin": -1052774.037634491
        },
        "maximum": {
          "xmax": 5666163.380958509,
          "xmin": -4844430.556896179,
          "ymax": 4170111.408136484,
          "ymin": -1052774.037634491
        },
        "spatialReference": { "wkid": 3978 }
      },
      {
        "id": "EXT_ESRI_World_AuxMerc_3857",
        "default": {
          "xmin": -16763712,
          "ymin": 5165908,
          "xmax": -5688293,
          "ymax": 10649806
        },
        "full": {
          "xmax": -5688293,
          "xmin": -16763712,
          "ymax": 10649806,
          "ymin": 5165908
        },
        "maximum": {
          "xmax": -5688293,
          "xmin": -16763712,
          "ymax": 10649806,
          "ymin": 5165908
        },
        "spatialReference": { "wkid": 102100, "latestWkid": 3857 }
      }
    ],
    "lodSets": [
      {
        "id": "LOD_NRCAN_Lambert_3978",
        "lods": [
          { "level": 3, "resolution": 7937.5158750317505, "scale": 30000000 },
          { "level": 4, "resolution": 4630.2175937685215, "scale": 17500000 },
          { "level": 5, "resolution": 2645.8386250105837, "scale": 10000000 },
          { "level": 6, "resolution": 1587.5031750063501, "scale": 6000000 },
          { "level": 7, "resolution": 926.0435187537042, "scale": 3500000 },
          { "level": 8, "resolution": 529.1677250021168, "scale": 2000000 },
          { "level": 9, "resolution": 317.50063500127004, "scale": 1200000 },
          { "level": 10, "resolution": 185.20870375074085, "scale": 700000 },
          { "level": 11, "resolution": 111.12522225044451, "scale": 420000 },
          { "level": 12, "resolution": 66.1459656252646, "scale": 250000 },
          { "level": 13, "resolution": 38.36466006265346, "scale": 145000 },
          { "level": 14, "resolution": 22.48962831258996, "scale": 85000 },
          { "level": 15, "resolution": 13.229193125052918, "scale": 50000 },
          { "level": 16, "resolution": 7.9375158750317505, "scale": 30000 },
          { "level": 17, "resolution": 4.6302175937685215, "scale": 17500 }
        ]
      },
      {
        "id": "LOD_ESRI_World_AuxMerc_3857",
        "lods": [
          {
            "level": 0,
            "resolution": 19567.87924099992,
            "scale": 73957190.948944
          },
          {
            "level": 1,
            "resolution": 9783.93962049996,
            "scale": 36978595.474472
          },
          {
            "level": 2,
            "resolution": 4891.96981024998,
            "scale": 18489297.737236
          },
          {
            "level": 3,
            "resolution": 2445.98490512499,
            "scale": 9244648.868618
          },
          {
            "level": 4,
            "resolution": 1222.992452562495,
            "scale": 4622324.434309
          },
          {
            "level": 5,
            "resolution": 611.4962262813797,
            "scale": 2311162.217155
          },
          {
            "level": 6,
            "resolution": 305.74811314055756,
            "scale": 1155581.108577
          },
          {
            "level": 7,
            "resolution": 152.87405657041106,
            "scale": 577790.554289
          },
          {
            "level": 8,
            "resolution": 76.43702828507324,
            "scale": 288895.277144
          },
          {
            "level": 9,
            "resolution": 38.21851414253662,
            "scale": 144447.638572
          },
          {
            "level": 10,
            "resolution": 19.10925707126831,
            "scale": 72223.819286
          },
          {
            "level": 11,
            "resolution": 9.554628535634155,
            "scale": 36111.909643
          },
          {
            "level": 12,
            "resolution": 4.77731426794937,
            "scale": 18055.954822
          },
          {
            "level": 13,
            "resolution": 2.388657133974685,
            "scale": 9027.977411
          },
          {
            "level": 14,
            "resolution": 1.1943285668550503,
            "scale": 4513.988705
          },
          {
            "level": 15,
            "resolution": 0.5971642835598172,
            "scale": 2256.994353
          },
          {
            "level": 16,
            "resolution": 0.29858214164761665,
            "scale": 1128.497176
          },
          {
            "level": 17,
            "resolution": 0.14929107082380833,
            "scale": 564.248588
          },
          {
            "level": 18,
            "resolution": 0.07464553541190416,
            "scale": 282.124294
          },
          {
            "level": 19,
            "resolution": 0.03732276770595208,
            "scale": 141.062147
          },
          {
            "level": 20,
            "resolution": 0.01866138385297604,
            "scale": 70.5310735
          }
        ]
      }
    ],
    "tileSchemas": [
      {
        "id": "cad53536",
        "name": "Canada",
        "extentSetId": "EXT_NRCAN_Lambert_3978",
        "lodSetId": "LOD_NRCAN_Lambert_3978",
        "overviewUrl": {
          "layerType": "esriTile",
          "url": "https://maps-cartes.services.geo.ca/server2_serveur2/rest/services/BaseMaps/CBMT3978/MapServer"
        }
      },
      {
        "id": "e0ceca1d",
        "name": "World",
        "extentSetId": "EXT_ESRI_World_AuxMerc_3857",
        "lodSetId": "LOD_ESRI_World_AuxMerc_3857",
        "overviewUrl": {
          "layerType": "esriTile",
          "url": "https://services.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer"
        }
      }
    ],
    "baseMaps": [
      {
        "id": "f7f9f166",
        "name": "Transport with labels",
        "description": "This Canadian basemap provides geographic context with bilingual labels and an emphasis on transportation networks.  From Natural Resources Canada.",
        "altText": "Transport with labels",
        "thumbnailUrl": "",
        "layers": [
          {
            "id": "CBME_CBCE_HS_RO_3978",
            "layerType": "esriFeature",
            "url": "https://maps-cartes.services.geo.ca/server2_serveur2/rest/services/BaseMaps/CBME_CBCE_HS_RO_3978/MapServer",
            "opacity": 1
          },
          {
            "id": "CBMT",
            "layerType": "esriFeature",
            "url": "https://maps-cartes.services.geo.ca/server2_serveur2/rest/services/BaseMaps/CBMT3978/MapServer",
            "opacity": 0.75
          }
        ],
        "tileSchemaId": "cad53536",
        "attribution": {
          "text": { "enabled": true },
          "logo": { "enabled": false }
        }
      },
      {
        "id": "48fc375c",
        "name": "Transport without labels",
        "description": "This Canadian basemap provides geographic context with an emphasis on transportation networks and without labels.  From Natural Resources Canada.",
        "altText": "Transport without labels",
        "thumbnailUrl": "",
        "layers": [
          {
            "id": "CBME_CBCE_HS_RO_3978",
            "layerType": "esriFeature",
            "url": "https://maps-cartes.services.geo.ca/server2_serveur2/rest/services/BaseMaps/CBME_CBCE_HS_RO_3978/MapServer",
            "opacity": 1
          },
          {
            "id": "CBMT_CBCT_GEOM_3978",
            "layerType": "esriFeature",
            "url": "https://maps-cartes.services.geo.ca/server2_serveur2/rest/services/BaseMaps/CBMT_CBCT_GEOM_3978/MapServer",
            "opacity": 0.75
          }
        ],
        "tileSchemaId": "cad53536",
        "attribution": {
          "text": { "enabled": true },
          "logo": { "enabled": false }
        }
      },
      {
        "id": "431b5b89",
        "name": "Grey",
        "description": "This Canadian basemap provides geographic context with a minimalist appearance. From Natural Resources Canada.",
        "altText": "Grey",
        "layers": [
          {
            "id": "SMR",
            "layerType": "esriFeature",
            "url": "https://maps-cartes.services.geo.ca/server2_serveur2/rest/services/BaseMaps/Simple/MapServer",
            "opacity": 1
          }
        ],
        "tileSchemaId": "cad53536",
        "attribution": {
          "text": { "enabled": true },
          "logo": { "enabled": false }
        }
      },
      {
        "id": "2a30f9b6",
        "name": "Shaded relief",
        "description": "This Canadian base map provides geographic context using shaded relief. From Natural Resources Canada.",
        "altText": "Shaded relief",
        "layers": [
          {
            "id": "CBME_CBCE_HS_RO_3978",
            "layerType": "esriFeature",
            "url": "https://maps-cartes.services.geo.ca/server2_serveur2/rest/services/BaseMaps/CBME_CBCE_HS_RO_3978/MapServer",
            "opacity": 1
          }
        ],
        "tileSchemaId": "cad53536",
        "attribution": {
          "text": { "enabled": true },
          "logo": { "enabled": false }
        }
      },
      {
        "id": "18e13bfd",
        "name": "Transport with labels",
        "description": "This worldwide basemap provides geographic context with bilingual labels and an emphasis on transportation networks. From Natural Resources Canada.",
        "typeSummary": "",
        "altText": "Transport with labels",
        "thumbnailUrl": "",
        "tileSchemaId": "e0ceca1d",
        "attribution": {
          "text": { "enabled": true, "value": "" },
          "logo": { "enabled": false, "value": "", "link": "" }
        },
        "layers": [
          {
            "id": "WorldTransportLabel",
            "layerType": "esriFeature",
            "url": "https://maps-cartes.services.geo.ca/server2_serveur2/rest/services/BaseMaps/CBMT_CBCT_GEOM_3857/MapServer",
            "opacity": 1
          },
          {
            "id": "WorldLabel",
            "layerType": "esriFeature",
            "url": "https://maps-cartes.services.geo.ca/server2_serveur2/rest/services/BaseMaps/CBMT_TXT_3857/MapServer",
            "opacity": 1
          }
        ]
      },
      {
        "id": "bb32d78a",
        "name": "Transport without labels",
        "description": "This worldwide basemap provides geographic context with an emphasis on transportation networks and without labels. From Natural Resources Canada.",
        "typeSummary": "",
        "altText": "Transport without labels",
        "thumbnailUrl": "",
        "tileSchemaId": "e0ceca1d",
        "attribution": {
          "text": { "enabled": true, "value": "" },
          "logo": { "enabled": false, "value": "", "link": "" }
        },
        "layers": [
          {
            "id": "WorldTransport",
            "layerType": "esriFeature",
            "url": "https://maps-cartes.services.geo.ca/server2_serveur2/rest/services/BaseMaps/CBMT_CBCT_GEOM_3857/MapServer",
            "opacity": 1
          }
        ]
      },
      {
        "id": "e448891a",
        "name": "Imagery",
        "description": "This worldwide basemap provides one meter or better satellite and aerial imagery in many parts of the world and lower resolution satellite imagery for the rest. From ESRI.",
        "altText": "Imagery",
        "layers": [
          {
            "id": "World_Imagery",
            "layerType": "esriFeature",
            "url": "https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer",
            "opacity": 1
          }
        ],
        "tileSchemaId": "e0ceca1d",
        "attribution": {
          "text": { "enabled": true },
          "logo": { "enabled": true }
        }
      },
      {
        "id": "b5c5be99",
        "name": "Physical",
        "description": "This worldwide basemap presents the Natural Earth physical map at 1.24km per pixel for most of the world and 500m for the United States. From ESRI.",
        "altText": "Physical",
        "layers": [
          {
            "id": "World_Physical_Map",
            "layerType": "esriFeature",
            "url": "https://services.arcgisonline.com/arcgis/rest/services/World_Physical_Map/MapServer",
            "opacity": 1
          }
        ],
        "tileSchemaId": "e0ceca1d",
        "attribution": {
          "text": { "enabled": true },
          "logo": { "enabled": true }
        }
      },
      {
        "id": "ae2713e8",
        "name": "Street Map",
        "description": "This worldwide street basemap presents highway-level data.  From ESRI.",
        "altText": "Street Map",
        "layers": [
          {
            "id": "World_Street_Map",
            "layerType": "esriFeature",
            "url": "https://services.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer",
            "opacity": 1
          }
        ],
        "tileSchemaId": "e0ceca1d",
        "attribution": {
          "text": { "enabled": true },
          "logo": { "enabled": true }
        }
      },
      {
        "id": "06acee3b",
        "name": "Shaded relief",
        "description": "This worldwide basemap provides geographic context using a shaded relief.  From ESRI.",
        "altText": "Shaded relief",
        "layers": [
          {
            "id": "World_Shaded_Relief",
            "layerType": "esriFeature",
            "url": "https://services.arcgisonline.com/arcgis/rest/services/World_Shaded_Relief/MapServer",
            "opacity": 1
          }
        ],
        "tileSchemaId": "e0ceca1d",
        "attribution": {
          "text": { "enabled": true },
          "logo": { "enabled": true }
        }
      },
      {
        "id": "c53f8920",
        "name": "Topographic",
        "description": "This worldwide basemap provides geographic context with an emphasis on topography.  From ESRI.",
        "altText": "Topographic",
        "layers": [
          {
            "id": "World_Topographic",
            "layerType": "esriFeature",
            "url": "https://services.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer",
            "opacity": 1
          }
        ],
        "tileSchemaId": "e0ceca1d",
        "attribution": {
          "text": { "enabled": true },
          "logo": { "enabled": true }
        }
      }
    ],
    "layers": [
      {
        "layerChoice": "file",
        "layerType": "esriFeature",
        "fileType": "geojson",
        "colour": "#ff0000",
        "tolerance": 5,
        "outfields": "*",
        "controls": [
          "opacity",
          "visibility",
          "boundingBox",
          "query",
          "snapshot",
          "metadata",
          "boundaryZoom",
          "refresh",
          "reload",
          "remove",
          "settings",
          "data",
          "styles"
        ],
        "disabledControls": [],
        "enableStructuredDelete": false,
        "state": {
          "opacity": 1,
          "visibility": true,
          "boundingBox": false,
          "query": true,
          "snapshot": false,
          "hovertips": true
        },
        "table": {
          "title": "",
          "maximize": false,
          "lazyFilter": false,
          "applyMap": false,
          "showFilter": true,
          "filterByExtent": false,
          "searchStrictMatch": false,
          "printEnabled": false,
          "columns": []
        },
        "name": "Fire Hotspots",
        "id": "Fire Hotspots***f4e89cc7",
        "url": "https://cwfis.cfs.nrcan.gc.ca/geoserver/public/ows?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&typeName=public:hotspots_2022&LAYERS=public:hotspots_2022&STYLES=cwfis_hotspots_last24hrs&outputFormat=application%2Fjson&cql_filter=rep_date%20between%20%272022-08-11T00:00:00Z%27%20and%20%272022-08-11T23:59:59Z%27"
      }
    ],
    "legend": {
      "legendChoice": "autopopulate",
      "type": "autopopulate",
      "root": { "name": "root", "children": [] }
    }
  },
  "ui": {
    "sideMenu": {
      "items": [
        ["layers", "basemap"],
        ["fullscreen", "export", "share", "touch", "help"],
        ["plugins"]
      ],
      "logo": true
    },
    "about": { "content": "-- placeholder --", "aboutChoice": "string" },
    "fullscreen": false,
    "theme": "default",
    "logoUrl": "",
    "failureFeedback": { "failureMessage": "", "failureImageUrl": "" },
    "title": "",
    "appBar": {
      "sideMenu": true,
      "geoSearch": true,
      "basemap": true,
      "layers": true
    },
    "navBar": {
      "zoom": "buttons",
      "extra": ["fullscreen", "geoLocator", "home", "help"]
    },
    "restrictNavigation": false,
    "help": { "folderName": "default" },
    "legend": {
      "reorderable": true,
      "allowImport": true,
      "isOpen": { "large": true, "medium": false, "small": false }
    },
    "tableIsOpen": {
      "id": "",
      "dynamicIndex": "",
      "large": false,
      "medium": false,
      "small": false
    },
    "widgetsWidget": ""
  },
  "services": {
    "proxyUrl": "https://maps.canada.ca/wmsproxy/ws/wmsproxy/executeFromProxy",
    "geometryUrl": "https://maps-cartes.services.geo.ca/server2_serveur2/rest/services/Utilities/Geometry/GeometryServer",
    "exportMapUrl": "https://maps-cartes.services.geo.ca/server2_serveur2/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task",
    "search": {
      "serviceUrls": {
        "geoNames": "https://geogratis.gc.ca/services/geoname/en/geonames.json",
        "geoLocation": "https://geogratis.gc.ca/services/geolocation/en/locate?q=",
        "geoSuggest": "https://geogratis.gc.ca/services/geolocation/en/suggest?q=",
        "provinces": "https://geogratis.gc.ca/services/geoname/en/codes/province.json",
        "types": "https://geogratis.gc.ca/services/geoname/en/codes/concise.json"
      },
      "disabledSearches": ["NTS", "FSA", "SCALE", "LAT/LNG"],
      "settings": {
        "categories": [],
        "sortOrder": [],
        "maxResults": 100,
        "officialOnly": false
      }
    },
    "export": {
      "title": { "isSelected": true, "isSelectable": true, "value": "" },
      "footnote": {
        "isSelected": true,
        "isSelectable": false,
        "value": "© Her Majesty the Queen in Right of Canada, represented by the Minister of Natural Resources"
      },
      "map": { "isSelected": true, "isSelectable": false },
      "mapElements": { "isSelected": true, "isSelectable": true },
      "legend": {
        "isSelected": true,
        "isSelectable": true,
        "showInfoSymbology": false,
        "showControlledSymbology": false,
        "columnWidth": 350
      },
      "timestamp": { "isSelected": true, "isSelectable": true },
      "timeout": 120000,
      "cleanCanvas": false
    },
    "corsEverywhere": false,
    "googleAPIKey": "",
    "esriLibUrl": ""
  },
  "version": "3.3.5",
  "language": "en-CA",
  "plugins": {
    "rangeSlider": { "enable": false, "autonit": true },
    "coordInfo": { "enable": false },
    "areasOfInterest": { "enable": false },
    "chart": { "enable": false },
    "swiper": { "enable": false },
    "draw": { "enable": false },
    "thematicSlider": { "enable": false }
  }
}
prosperva commented 1 year ago

I just saw something that might work. There is a reload beside each layer

Screenshot 2023-01-19 at 10 16 39 AM

Is it available using RAMP.mapById("rv-map").layers.allLayers[0].reload()?

james-rae commented 1 year ago

Mayyybe. You could try using custom API code to adjust the URL then force a reload. Wasn't designed for that type of thing but it might work. Otherwise your best approach is when a user changes their time slider, issue API calls to remove the old feature layer and then generate a new layer with the new URL.

prosperva commented 1 year ago

Are there specific PI calls in RAMP that implement the best approach you are suggesting?I am trying to dig through the source code.

james-rae commented 1 year ago

After you've fetched the map API for your active map:

mapAPI.layers.addLayer(<layerConfigJSON>) mapAPI.layers.removeLayer(<layerid>)

Hopefully that's all it takes, been years since I've really used these

prosperva commented 1 year ago

@james-rae I tried the above and although the layer is added to the layers collection, it does not appear in the layers panel on the left side. Would you know what I am missing?

prosperva commented 1 year ago

Here is the code I am using:

RAMP.mapById("rv-map").layers.addLayer({
        "layerChoice": "file",
        "layerType": "esriFeature",
        "fileType": "geojson",
        "colour": "#3355FF",
        "tolerance": 5,
        "outfields": "*",
        "controls": [
          "opacity",
          "visibility",
          "boundingBox",
          "query",
          "snapshot",
          "metadata",
          "boundaryZoom",
          "refresh",
          "reload",
          "remove",
          "settings",
          "data",
          "styles"
        ],
        "disabledControls": [],
        "enableStructuredDelete": false,
        "state": {
          "opacity": 1,
          "visibility": true,
          "boundingBox": false,
          "query": true,
          "snapshot": false,
          "hovertips": true
        },
        "table": {
          "title": "",
          "maximize": false,
          "lazyFilter": false,
          "applyMap": false,
          "showFilter": true,
          "filterByExtent": false,
          "searchStrictMatch": false,
          "printEnabled": false,
          "columns": []
        },
        "name": "Test layer",
        "id": "test_layer_id",
        "url": "https://cwfis.cfs.nrcan.gc.ca/geoserver/public/ows?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&typeName=public%3Afirewx_scribe_fcst&outputFormat=application%2Fjson"
      })
james-rae commented 1 year ago

It works for me. I'm assuming you're still using the same application config that you pasted Jan 19th? Specifically, your map.legend.type value is set to autopopulate?

As a working example, you can visit this sample page, and then paste this code in the console. I've also tried replacing the layerConfig var to what you provided above, and it appeared in the legend as well.

var layerConfig = {
  id: "testfun",
  layerType: "esriFeature",
  url: "https://section917.canadacentral.cloudapp.azure.com/arcgis/rest/services/TestData/EcoAction/MapServer/6"
};

var map = RAMP.mapById("fgpmap");
map.layers.addLayer(layerConfig);
prosperva commented 1 year ago

The legend is different for this one and is set as structured

james-rae commented 1 year ago

So structured mode will not make assumptions or do stuff for you. There is a very rudimentary legend API, I've tried to dig up some samples to point you in the right direction but you'll have to play around with it.

var map = RAMP.mapById("yourmapid");
map.layers.addLayer(layerConfig);

var legend = map.ui.configLegend;

// this should give a JSON array of your current contents of the legend.
var legendContent = legend.configSnippets;

// newSnippet would be the new legend item you want to add.
// You'll need to look at the existing values and match the object format;
// hopefully it's just a matter of cut and paste with minor adjustments to get it right
legendContent.push(newSnippet);

// this should cause the legend control to update to the new definition
legend.configSnippets = legendContent;

Looking at this test script file might also have some helpful nuggets to steal. Again I hope this works, but it was a basic start to an API that got deprioritized and never really used that much in practice so apologies if there are lurking bugs.

prosperva commented 1 year ago

Yeah. I assumed the way when you use the add data feature worked the same way. When you add a layer using data, it add the layer at the top of other layers in the panel.

Nevertheless, the code sample you just provided is a step forward. I will explore with it.

Thanks again

james-rae commented 1 year ago

The add data wizard has to make a default choice of where to add. Or else we'd need to build a giant UI for user to pick where in the legend the new layer would lurk...way too much work. When adding via API calls, we leave it open in hopes to give maximum flexibility to the programmer (while providing bad APIs lol... we've tried to improve the situation in RAMP4).