Esri / solution.js

TypeScript wrappers running in Node.js and modern browsers for transferring ArcGIS Online items from one organization to another.
https://esri.github.io/solution.js/
Apache License 2.0
39 stars 12 forks source link

Add Vector Tile Layer type (Authored w/ Vector Tile Style Editor) #46

Closed MikeTschudi closed 1 year ago

MikeTschudi commented 5 years ago

We need to support deploying custom basemaps that are authored using the Vector Tile Style Editor. These items have the type "Vector Tile Service", but they are a unique subset of this item type in that they just store the definition of how the vector tiles are symbolized, not the actual tiles themselves.

This request is to support this specific kind of Vector Tile Services, not all as the api for creating a hosted Vector Tile Service is much more complicated and would require additional research.

The kind of Vector Tile Service that I would like to support in this issue will have the typeKeyword 'Vector Tile Style Editor". Here is an example of this item type in AGOL: 8001dcfd09584a8282084ee78f54b792. This item type has no data property, it just has a collection of resources that need to be included in the solution. There are no dependencies of this item type, as long as the resources are copied with the item, it will work as expected.

During creation I would like to look in web maps for this item type. It could be in the operationalLayers or more likely it will be in the "baseMap": { "baseMapLayers" : [] property. I would like during creation to loop over the baseMapLayers and if the layer has an "itemId" property, we check that itemId and see if it is a Vector Tile Service like described above. If it is we should templatize it and bring it into the solution item. We also then need to add variables for the itemId property and the "styleUrl" property of the basemapLayer. Below is a sample web map that you can test with. It has the same Vector Tile Service in the operationalLayers and the baseMap.

4e7652554b9f43bd9423e3b27b56d3dc

MikeTschudi commented 1 year ago

@chris-fox, do we ignore Vector Tile Services that are not authored using the Vector Tile Style Editor?

For example, the following modification of webmap 4e7652554b9f43bd9423e3b27b56d3dc has a vector tile layer from the JSAPI samples added as an operational layer. This layer--fe76a212bb2c42259f22971e3d771c60--is in my account and has a styleUrl, but it does not have the typeKeyword 'Vector Tile Style Editor". (I added the layer via the Map Viewer, not a JSON editor.)

{
  "operationalLayers": [
    {
      "id": "187dd95bb45-layer-3",
      "title": "Nova (German)",
      "itemId": "fe76a212bb2c42259f22971e3d771c60",
      "layerType": "VectorTileLayer",
      "styleUrl": "https://www.arcgis.com/sharing/rest/content/items/fe76a212bb2c42259f22971e3d771c60/resources/styles/root.json"
    },
    {
      "id": "187be9ab919-layer-2",
      "title": "Custom World Navigation Map",
      "itemId": "8001dcfd09584a8282084ee78f54b792",
      "layerType": "VectorTileLayer",
      "styleUrl": "https://www.arcgis.com/sharing/rest/content/items/8001dcfd09584a8282084ee78f54b792/resources/styles/root.json"
    }
  ],
  "baseMap": {
    "baseMapLayers": [
      {
        "id": "World_Hillshade_3805",
        "opacity": 1,
        "title": "World Hillshade",
        "url": "https://services.arcgisonline.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer",
        "visibility": true,
        "layerType": "ArcGISTiledMapServiceLayer"
      },
      {
        "id": "187be888e75-layer-2",
        "title": "Custom World Navigation Map",
        "itemId": "8001dcfd09584a8282084ee78f54b792",
        "layerType": "VectorTileLayer",
        "styleUrl": "https://www.arcgis.com/sharing/rest/content/items/8001dcfd09584a8282084ee78f54b792/resources/styles/root.json"
      }
    ],
    "title": "Topographic"
  }
}
chris-fox commented 1 year ago

@MikeTschudi, I want to avoid packaging Vector Tile layers that are just Esri provided basemaps. The item you reference, fe76a212bb2c42259f22971e3d771c60, is actually owned by the user esri_localization and this is not something I would like to deploy with the solution. I think sticking to the Vector Tile Style Editor typeKeyword ensures that the user has edited the style and it is something that could be reasonably be packaged with the solution.

shoe913 commented 1 year ago

@MikeTschudi

There are some issues occurring post deployment that appear to be occurring due to how we are packaging this and then subsequently deploying. This prevents the item from being edited after being deployed.

In packaging, we are over creating variables for the item. The URL for the item is getting a variable, however this should stay as the original basemap's URL (for example: https://basemaps.arcgis.com/arcgis/rest/services/World_Basemap_v2/VectorTileServer)

image

It looks like we also need to make some tiny changes in the resource files (I'm hoping this is possible). After the above change is made, the map will load in the editor, however the app throws warnings indicating specific files cannot be accessed. The files referenced were packaged and deployed, however the references still point to the original item path.

info/root.json: image

styles.root.json image

MikeTschudi commented 1 year ago

Thank you for the detailed specs, @shoe913!

shoe913 commented 1 year ago

Verified