Select to view content in your preferred language

Arcade Question

216
3
Jump to solution
07-22-2025 06:44 AM
Labels (1)
GaryMorris
Occasional Contributor

I am working on an Arcade script that will use a parcel layer to intersect with a zoning layer and return the zoning that intersects with the parcel.  I have successfully gotten the two layers to intersect and return the zoning, the issue is that the data is not clean, so I need to return the value that intersects with the center of the parcel.  My code looks like this:

var other_layer = (FeatureSetByName($map, "Zoning Layer", ["Zoning"]))


 var firstfeature = First(Intersects($Feature, other_layer));

 return firstfeature["Zoning"];
 
Can anyone help me alter this to get the intersection of the center.  Any help would be greatly appreciated.
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RPGIS
by MVP Regular Contributor
MVP Regular Contributor

Simple enough. I am guessing that the parcel intersects multiple zoning layers and rather than getting the zone with the greatest area of intersect it returns the first record of whichever zone intersects. Here is one option that will work for your given situation.

var other_layer = FeatureSetByName($map, "Zoning Layer", ["Zoning"])

var IntF = Intersects($Feature, other_layer)
var MI = Max( IntF, 'shapeareafield' )
var F = First(Filter(IntF,'shapeareafield = @M' ))
iif( TypeOf( F == 'Feature', F["Zoning"], $feature.Zoning )

/*
Option 2
var other_layer = FeatureSetByName($map, "Zoning Layer", ["Zoning"])
var F = First(Intersects(Centroid($Feature), other_layer))
iif( TypeOf( F == 'Feature', F["Zoning"], $feature.Zoning )
*/

Another would be to use the 'Centroid' function to turn your polygon to a point and get the intersecting value that way.

View solution in original post

3 Replies
RPGIS
by MVP Regular Contributor
MVP Regular Contributor

Simple enough. I am guessing that the parcel intersects multiple zoning layers and rather than getting the zone with the greatest area of intersect it returns the first record of whichever zone intersects. Here is one option that will work for your given situation.

var other_layer = FeatureSetByName($map, "Zoning Layer", ["Zoning"])

var IntF = Intersects($Feature, other_layer)
var MI = Max( IntF, 'shapeareafield' )
var F = First(Filter(IntF,'shapeareafield = @M' ))
iif( TypeOf( F == 'Feature', F["Zoning"], $feature.Zoning )

/*
Option 2
var other_layer = FeatureSetByName($map, "Zoning Layer", ["Zoning"])
var F = First(Intersects(Centroid($Feature), other_layer))
iif( TypeOf( F == 'Feature', F["Zoning"], $feature.Zoning )
*/

Another would be to use the 'Centroid' function to turn your polygon to a point and get the intersecting value that way.

GaryMorris
Occasional Contributor

Thank you!  This works great!

0 Kudos
RPGIS
by MVP Regular Contributor
MVP Regular Contributor

You're welcome.

0 Kudos