How do I use an arcade expression to tell me which polygon a linear feature has the biggest footprint in

175
0
03-24-2020 04:20 PM
FranciscoRodriguez4
New Contributor

Hello, I need helping crafting an Arcade expression in the AGOL Field Calculator:

As you can see below, I have two polygons that are intersected by a linear feature.  The current arcade function that I crafted below  ---> Counts the number of polygons that the linear feature goes through and lists the name of the polygons.    The end result in something like:

This street crosses X number of polygons:

Street Crosses:

1) Polygon A

2) Polygon B

 

var complex = FeatureSetById($map, /* DCR Complexes */ "ROAD_DCR_FINAL_1127");

var linetwo = intersects(complex, $feature);
var cnttwo = Count(linetwo);

var result = "This road crosses " + cnttwo + " DCR Complex Polygons:";
for (var f in linetwo) {
result += TextFormatting.NewLine + f.COMPLEX;
}

return result;

What I ultimately need ,if possible, is for the script to tell me which polygon the linear feature has the biggest footprint in.  In the diagram above, the ideal script would give me the result of :

Polygon B

Any help would be appreciated. 

Thanks##

0 Kudos
0 Replies