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:
If I comment out the Within function and just tell it to return all zoning data, it works:
The difference between my parcel feature layer and my zoning feature layer is that the zoning layer has three layers in it:
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.
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.
*/
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.