(Arcade) how can I extract data from only the top polygon?

147
1
a month ago
neomapper
Occasional Contributor

I have a polygon layer with two overlapping grids, each with different inspection intervals - Distribution (36 months) and business districts (12 months). How can I ensure that my meter inspections check if they are located within a business district and pull the correct inspection interval? Currently, the inspections are only pulling the green polygon with a 36-month interval.

 

var point = Geometry($feature);

var polygon_layer = FeatureSetByName($map, 'Leak Survey Area');

var polygons = Intersects(polygon_layer, point);

if (Count(polygons) > 0) {
  for (var f in polygon_layer){
    return f.interval
}
  }
  else {
    return 36;
}


return (Count(polygons) > 0)

 

neomapper_1-1713894699795.png

neomapper_3-1713894790091.png

 

 

 

 

 

 

0 Kudos
1 Reply
JustinReynolds
Occasional Contributor III

Hello,

One way is to Filter your feature set by your render field before doing the intersect.

 

var point = Geometry($feature);

var inspectionType = 'Business District';

var polygon_layer = Filter(
                      FeatureSetByName(
                        $map, 'Leak Survey Area', ['*'], true
                      ), 
                      'unique_renderer_field_name_here = @inspectionType'
                     );

var polygons = Intersects(polygon_layer, point);

if (Count(polygons) > 0) {
  for (var f in polygon_layer){
    return f.interval
}
  }
  else {
    return 36;
}


return (Count(polygons) > 0)

 

- Justin Reynolds, PE