Select to view content in your preferred language

Within() Arcade Function and multi-layer feature services

40
3
6 hours ago
Labels (1)
AmyRoust
Frequent Contributor

Is there a trick to using the Within function when referencing a layer in a multi-layer feature layer? I used a simple Within function to add the intersecting parcel PIN number to an address point's pop-up, but when I try to get its zoning, here's what happens:

AmyRoust_0-1759771648220.png

If I comment out the Within function and just tell it to return all zoning data, it works:

AmyRoust_1-1759771695741.png

The difference between my parcel feature layer and my zoning feature layer is that the zoning layer has three layers in it:

AmyRoust_3-1759771834658.png

 

The FeatureSetByName function doesn't seem to care that it's in a group, but maybe Within does?

I did try adding the Lawrence Zoning District sublayer by itself to the map, but I got the same results.

AmyRoust_4-1759771990616.png

 

0 Kudos
3 Replies
RPGIS
by MVP Regular Contributor
MVP Regular Contributor

Hi @AmyRoust,

So the within function returns a feature set of the features that fall within the specified layer. If you have an instance where some layers may overlap others then what I might suggest is any of the following.

var FS = FeatureSetByName($map, 'Zoning Districts - Lawrence Zoning District',['ZoningDistrict'],True)
var Address = $feature
if( TypeOf(Geometry($feature)) == 'Polygon' ){ Address = Centroid($feature) }
var AddrWithin = Within(address,FS)
iif( Count(AddrWithin)>0, AddrWithin, 'No features are within the layer')
/*
Note: the intersects function can also be used if the input layer is a point feature.
*/
0 Kudos
AmyRoust
Frequent Contributor

@RPGIS - no luck, but I appreciate the suggestion.

AmyRoust_0-1759783836518.png

 

0 Kudos
RPGIS
by MVP Regular Contributor
MVP Regular Contributor

Then it might helpful then to use the intersects function to get the information that you need. It may also require that you loop through multiple features to get a dictionary of field values to pull from.

0 Kudos