Select to view content in your preferred language

Arcade Intersect Expression returning wrong values

874
7
Jump to solution
10-17-2023 07:24 AM
Labels (3)
BrandonPrice1
Occasional Contributor

The ArcGIS Arcade intersect expression in this web map does not work all the time. It picks up nearby values instead of the correct value in certain cases. For instance, if I search for parcel 7345003005 and then click the area directly above it, the Zone is supposed to be SP but is returning A-1.

BrandonPrice1_0-1697552277854.png

 

This is the snippet:

 

var zoning = FeatureSetByName($datastore,"Zoning");
var zone = First(Intersects(zoning, $feature));
return zone["ZONE"]

 

Other threads said the reason is because using "First" returns the first value of the array so what would be a way to resolve it?

0 Kudos
1 Solution

Accepted Solutions
BrandonPrice1
Occasional Contributor

My co-worker suggested to add a negative buffer on the intersected layer which seems to return the right zone now. I've seen this workaround solution on a thread before, but couldn't find it.

 

var intersectLayer = Intersects(FeatureSetByName($datastore,"Zoning"), Buffer($feature, -30, "feet"));
var intersect = First(intersectLayer)
return intersect["ZONE"]

 

View solution in original post

7 Replies
MobiusSnake
MVP

Does that parcel overlap multiple zones, one of which is A-1?

0 Kudos
BrandonPrice1
Occasional Contributor

Hi Mobius,

 

There was no overlap. I checked the layer the service was published from in ArcGIS Pro.

0 Kudos
KenBuja
MVP Esteemed Contributor

If you click outside the parcel, you're not going to get the results for parcel 7345003005, but for another parcel. If you click the arrow at the top of the popup to show the Parcel Boundary information, which parcel does it show?

One other thing to be aware of is that if you click very close to the border between two parcels, you'll probably get back results from both parcels. This is due to the click tolerance in AGOL, which will return all features within a certain radius of where you clicked. While this is good for returning results for point and line features, since you don't have to be exactly over the feature, it may return more results than you want for polygon features.

0 Kudos
BrandonPrice1
Occasional Contributor

Hi Ken,

 

I'm not trying to get the results for that parcel. It was just a reference parcel to get to the location in question quicker. I am clicking right in the middle of the feature (not on the sides) and it's returning the wrong result. Is there a workaround or solution to catch these errors?

0 Kudos
KenBuja
MVP Esteemed Contributor

There is something strange happening with your data. When I click on the stream bed between the houses, it does show as a long thin A-1 zone.

zone.png

However, if I load the Zoning service layer into ArcGIS Pro, I don't see that same polygon

zone1.png

I also notice some oddities in the zoning polygons in the area bounded by S Vermont, W 214, W Carson, and I-110. The online map is highlighting different zoning polygons than what shows. You can see an A-1 polygon in the top image that doesn't appear in Pro

0 Kudos
BrandonPrice1
Occasional Contributor

Hi Ken. That is because we have some trickery going on. The layer being clicked in the web map is not the zoning layer. It is a hidden layer called zoning SP (Specific Plan). The trickery only happens in zoning areas where the labels show as "SP". The second screenshot you provided is of a feature in the zoning layer. It has a zone of SP, but when intersected with the overlapping feature in the zoning SP (Specific Plan) layer, the intersect was returning a zone of A-1. This kept happening even though the zoning SP (Specific Plan) feature was fully contained zoning feature.

0 Kudos
BrandonPrice1
Occasional Contributor

My co-worker suggested to add a negative buffer on the intersected layer which seems to return the right zone now. I've seen this workaround solution on a thread before, but couldn't find it.

 

var intersectLayer = Intersects(FeatureSetByName($datastore,"Zoning"), Buffer($feature, -30, "feet"));
var intersect = First(intersectLayer)
return intersect["ZONE"]