Select to view content in your preferred language

Use FeatureSetByPortalItem to get items from a WebMap

761
1
09-03-2024 05:54 AM
Labels (1)
Matthew_Muehlhauser
Regular Contributor

Is there a way to get a FeatureSet from a WebMap using Arcade?

I'm currently working in a Dashboard, so I don't have access to the $map profile and am trying to access the features in the web map in the dashboard. So far, I've found a work around by creating a Map Image Layer content item that references the services in the map and can access that using FeatureSetByPortalItem, but it fails if I try to use FeatureSetByPortalItem with the Web Map ID.

Tags (1)
0 Kudos
1 Reply
Matthew_Muehlhauser
Regular Contributor

So, seems like the latest update to Arcade this week broke being able to use a Map Image Layer in the FeatureSetByPortalItem function. You now have to use Feature Services instead. If the layer is coming from a Map Server with multiple layers, then you still have to use the ID of the layer in the map server.

For example: I created a feature service item in AGOL from the 2nd layer in a map service (MapServer/1). When I try to get this layer using the FeatureSetByPortalItem, I have to use the layer ID from the map service and not 0 or the default as you would probably expect since it's a Feature Service and there's only 1 layer.

Correct: FeatureSetByPortalItem(portal, agol_id, 1)

The two below will return the first layer in the Map Service and not the second layer we are trying to get.

Wrong: FeatureSetByPortalItem(portal, agol_id)
Wrong: FeatureSetByPortalItem(portal, agol_id, 0)

0 Kudos