Select to view content in your preferred language

Accessing another layer in the same map service in Arcade

832
7
Jump to solution
10-12-2023 09:38 AM
Labels (3)
BrandonPrice1
Occasional Contributor

Hello,

 

Is it possible to access features from another layer in the same ArcGIS Server map service using Arcade?  The map service layers were added to the web map all together and not individually. I'm thinking no since no global variables are available.

 

Brandon

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

I think it has to do with it being a MapServer? Usually if you add your layer to the map using its layer ID, it will behave like a FeatureServer item.

Try adding the Zoning layer using its URL, https://arcgis.gis.lacounty.gov/arcgis/rest/services/DRP/ZNET_Public/MapServer/4

With that in the map, the expression builder should have access to the usual globals. Seems to work over here!

jcarlson_0-1697135539339.png

 

- Josh Carlson
Kendall County GIS

View solution in original post

0 Kudos
7 Replies
KenBuja
MVP Esteemed Contributor

It depends on what you're trying to do. Some profiles, like Popup, give you access to the $map profile variable, while Attribute Rules gives you access to the $datastore variable.

0 Kudos
BrandonPrice1
Occasional Contributor

Hi Ken. I tried $datastore prior to posting my issue and got an error saying it wasn't defined.

0 Kudos
jcarlson
MVP Esteemed Contributor

Where are you trying to implement this? If they're all in the same service, you ought to be able to use the global $datastore to access the other layers, as in the function FeatureSetByName.

- Josh Carlson
Kendall County GIS
0 Kudos
BrandonPrice1
Occasional Contributor

Hi Josh. This is for a popup for a layer in the service. The $datastore option returned an error of not defined.

BrandonPrice1_0-1697133933915.png

The service is public https://arcgis.gis.lacounty.gov/arcgis/rest/services/DRP/ZNET_Public/MapServer

I was trying to access the Zoning Sp Category layer from the Zoning layer. 

0 Kudos
BrandonPrice1
Occasional Contributor

I'm using the classic viewer also if that's a factor. This web map is being used in the old web appbuilder still.

0 Kudos
jcarlson
MVP Esteemed Contributor

I think it has to do with it being a MapServer? Usually if you add your layer to the map using its layer ID, it will behave like a FeatureServer item.

Try adding the Zoning layer using its URL, https://arcgis.gis.lacounty.gov/arcgis/rest/services/DRP/ZNET_Public/MapServer/4

With that in the map, the expression builder should have access to the usual globals. Seems to work over here!

jcarlson_0-1697135539339.png

 

- Josh Carlson
Kendall County GIS
0 Kudos
BrandonPrice1
Occasional Contributor

That's the only way I could think to do it also. Just wanted to double check. Thanks.

0 Kudos