Is it possible to set up an Arcade expression with the intersect function that references another layer within the same service as the features in which the expression is applied? Or, do you have to add each endpoint within the service individually in order to make the expression work?
For example, I have a service with three layers: address points, food inspector zones, and watershed inspector zones. If I add each of the endpoints individually, the following expression (in the address points) returns the desired value (from the food inspector zone layer):
However, if I add the whole service to my map and set up the same expression on the address points there it does NOT work. I get this error:
Does it simply not work within a service? Or do I have a wrong parameter?
Hi Xander. Is there any chance you can answer my question above? Can I set up an expression in my address points that includes the intersection function, and have that be based on one of the polygon features in the layers above it? Note, all three items are published in one map service. I can't get it to work this way but can when I add each endpoint individually... which isn't really feasible in the grand scheme of the web map and WAB app.
Hi @AdamGebhart ,
So you have a group layer in your (classic 3.x) web map and the Arcade expression I assume you are configuring in the pop-up. Is that correct?
When you want to access data in the map, I would suggest using the expression builder. There are two easy ways of assessing the data in the map, one is using $map that is creating problems, but since the data has the same datastore, you could try and use $datastore and see if that works. In the interface you can click on the arrow pointing to the right (">") next to "$datastore" and navigate to the layers in the same datastore as your feature.
this will list the layers (rest endpoints in the same service) and select the ones you need for the expression:
If you have any problems, let me know.
Thanks @XanderBakker. Unfortunately, I don't see the $datastore option. All I am seeing are the fields within this specific dataset. To clarify though, I am...
-Trying to use Intersects in a web map pop up for an address point layer, based on what inspector zone a point falls in.
-Building in the pop up expression builder.
-Said address points and inspector zones are present in the same AGS map service (not AGO feature layer) and the entire map service has been added to the web map.
I did try it where I replaced $map with $datastore (but no other changes) and that didn't work. Do you have an idea of how that full expression should look?
Hi @AdamGebhart ,
So the limitation might be in the way the service is added to the map. Would it be possible to have access to the map to have a look? You could share it with a group and invite me to that group using "xbakker.spx".
Just sent the invite, thank you. At the top of the map contents you'll see an address point layer and food and watershed inspector layers. Each of those is an item within a larger map service (see said map service below them in the contents) and have been added as individual items to this map.
I can get the expression to work when the individual instance of the address points is used, but not when attempting to do it purely in the map service list.
Hi @AdamGebhart ,
Thanks for sharing the map. However, I don't seem to have access to the services, so I can't really do anything at the moment. I can have a look at some of the sample Enterprise/ArcGIS Server services to see if I can replicate the situation. What version do you have for your Enterprise implementation?
Can you view this in a web map?
https://gis.johnsoncountyiowa.gov/arcgis/rest/services/PH_Inspect/MapServer
It's a different service, but the same three datasets I'm referencing in that map.
Hi @AdamGebhart ,
I continued with a map service (group layer) from a sample server and this is what I got:
Below you can see the classic web map with a group layer (map service: https://sampleserver6.arcgisonline.com/arcgis/rest/services/Military/MapServer) and the pop-up on the polygon areas show information from the intersecting units:
Here's the expression I used:
var spx = Portal('https://utility-esri-co.maps.arcgis.com');
var mili = FeatureSetByPortalItem(spx, 'e5cfe3e339394ffb82270e3791a32b6a', 2);
var fsint = Intersects(mili, $feature);
var result = "";
if (Count(fsint)>0) {
result = "Found " + Count(fsint) + " intersecting features:";
for (var f in fsint) {
result += TextFormatting.NewLine + " - " + f["SymbolName"];
}
} else {
result = "No intersection";
}
return result;
... and just tried, but I don't have access to the rest service you provided.