I am trying to write an arcade script on my pop-up for parcel. I have three polygon layers that represent 'Water Service Area", "Sewer Service Area", and "Reclaimed Service Area". I want to write the Arcade script so that when I select on a specific parcel it will return saying that the Parcel is on Water, or Sewer, or Reclaimed. I thought I had figured the code out but when I click around on the map, every pop-up says the same thing. It is not specific to that parcel. Here is the code I wrote:
expression 1
Parcel: {PARCEL}
This parcel is on City:
{expression/expr0}
{expression/expr1}
{expression/expr2}
I was reading old posts that maybe what I am trying to do is not possible. If someone has any advice or a work around that would be great.
Solved! Go to Solution.
What you'll have to do is check to see if an Intersection returns a feature for each of different layers. Or you could assume that a parcel would be in one of the three layers and only check the first two.
This script checks whether the feature intersects with the Water layer. If not, then it checks the Sewer area. If that doesn't return anything, it assumes it's in the Reclaimed area.
var water= FeatureSetByName($map, 'Water Service Area')
var WIntersects = Intersects($feature, water);
If (Count(WIntersects) > 0) return 'Water';
var sewer= FeatureSetByName($map, 'Sewer Service Area')
var sIntersects = First(Intersects($feature, sewer))
if (Count(sIntersects) > 0) return 'Sewer';
return 'Reclaimed Water';
One note. You shouldn't use a variable name that is a reserved word (like the function Intersects)
What you'll have to do is check to see if an Intersection returns a feature for each of different layers. Or you could assume that a parcel would be in one of the three layers and only check the first two.
This script checks whether the feature intersects with the Water layer. If not, then it checks the Sewer area. If that doesn't return anything, it assumes it's in the Reclaimed area.
var water= FeatureSetByName($map, 'Water Service Area')
var WIntersects = Intersects($feature, water);
If (Count(WIntersects) > 0) return 'Water';
var sewer= FeatureSetByName($map, 'Sewer Service Area')
var sIntersects = First(Intersects($feature, sewer))
if (Count(sIntersects) > 0) return 'Sewer';
return 'Reclaimed Water';
One note. You shouldn't use a variable name that is a reserved word (like the function Intersects)
Thank you very much! So I couldn't use this all in one expression as you have it written but what I did is split out the very first part of the expression.
Parcel: {PARCEL}
This parcel is on City:
{expression/expr3}
{expression/expr4}
{expression/expr5}
So when I ran the entire expression, it only read the first part of the expression then stopped. So when I clicked on an area that didn't have sewer for instance with whole script it returned blank. I hope this makes sense. I wrote all this out just in case someone else needs assistance with Intersect function.
Thanks again.