0

Perhaps I am confused but I want to use a shared layer from my ArcGIS Online account in a Web AppBuilder script similar to this:

 const view = new MapView({
    container: "viewDiv",
    map: new WebMap({
      portalItem: { // autocasts as new PortalItem
        id: "372b7caa8fe340b0a6300df93ef18a7e"
      },
      layers: [
        new FeatureLayer({
          portalItem: { // autocasts as new PortalItem
            id: "6012738cd1c74582a5f98ea30ae9876f"
          },
          labelingInfo: [labelClass],
          renderer: {
            type: "simple", // autocasts as new SimpleRenderer()
            symbol: {
              type: "simple-marker", // autocasts as new SimpleMarkerSymbol()
              color: "rgba(0,100,0,0.6)",
              size: 3,
              outline: {
                color: [0, 0, 0, 0.1],
                width: 0.5
              }
            }
          }
        })
      ]
    }),
    center: [-116.9250, 34.2501],
    zoom: 14
  });

Essentially I want to utilize either the portalItem id or add it using the arcGIS online url for the layer like this:

 var transportationLayer = new TileLayer({
            url: "https://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer",
            id: "streets",
            visibility: false
        });

How do I do this? When I go to my layer in ArcGIS online, I do not see the id or a url I can use.

0

It appears that I have resolved my own issue. The first time I tried this, I had loaded the layer from a file on my computer, rather than publish it. I went back and published the layer from ArcMap to my ArcGIS online hosted service, setting it to Feature Access (in Capabilities) and Sharing to my organization (or potentially, everyone). Once the layer was published, under details in the layer Overview, the url for sharing the layer was made available. I was able to test this in the ESRI sanbox to make sure it worked. enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.