TransWikia.com

Arcade Expression to Intersect Features and add Attribute to Popup

Geographic Information Systems Asked on May 5, 2021

New to Arcade. I have two features in an AGOL map, “SS Parcels” and “SS Zoning”. I would like to configure the popup for “SS Parcels” to also display the zoning code from “SS Zoning”.

It seems like this is possible from this article:
Overlapping Features in Pop-Ups

However I can’t seem to make my code work at all. It looks like the function “Intersects” actually returns a Boolean, maybe this was changed since the article was written. If I instead use the function “Intersection”, which returns a geometry, my code looks like this:

var intersectLayer = Intersection(Buffer($feature, -10, 'feet'),FeatureSetByName($map, 'SS Zoning'))
for (var f in intersectLayer){
return f.ZONING
}

2 Answers

Turns out I had some mismatched Layer names between the actual Layer name in the Item Description and the item in the Map Legend. I renamed everything to match and this solved my problem. Here is the final code which also adds some functionality to list multiple Zones if a parcel crosses a boundary.

var intersectLayer = Intersects(FeatureSetByName($map, "South Strabane 
Zoning"),Buffer($feature, -10, 'feet'))
var zones = ""
for (var f in intersectLayer){
    zones = concatenate(zones,f.ZONING," ")
}
return zones

Correct answer by RossV on May 5, 2021

I would try to do the following:

var intersectLayer = Intersects(FeatureSetByName($map, 'SS Zoning'), $feature),Buffer($feature, -10, 'feet');
for (var f in intersectLayer){
    return f.ZONING
}

I have not tried the code but a similar code works for me in the attribute rules.

Answered by Rubén M. Afonso Romero on May 5, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP