Select to view content in your preferred language

Attribute Rule for Point Intersecting Polygon Has Inconsistent Results

192
2
06-10-2024 02:34 PM
Labels (1)
SH_HD
by
New Contributor

Using ArcGIS Pro 3.2.2, Arc GIS Server Version: 11.1.0 (build 42869)

My Attribute Rule is set up to populate a Fire Hydrant's 'locationdetails' attribute with the appropriate Fire District domain code upon Editing or Updating.

Here is my Attribute Rule expression:

// Intersect Fire Hydrant with Fire District to calculate 'locationdetails'

var fsFire = FeatureSetByName($datastore, "gis.un.FireDistrict", ["district"], false);
var fsIntersectFire = Intersects(fsFire, $feature);
var cnt = Count(fsIntersectFire);

if (cnt > 0) {
var fFire = First(fsIntersectFire);

   if (fFire == null || IsEmpty(fFire)) {
   return 0; // No intersection, return 0 for 'Unknown'
   } else {
   var districtName = Trim(fFire["district"]);

   // Nested if statements to check district values
   if (districtName == "El Cajon") {
         return 1;
       } else if (districtName == "La Mesa") {
         return 2;
       } else if (districtName == "Lakeside") {
         return 3;
       } else if (districtName == "Lemon Grove") {
         return 4;
       } else if (districtName == "San Diego") {
         return 5;
       } else if (districtName == "San Miguel") {
        return 6;
      }
   }
}

The Attribute Rule works 100% of the time when I place or move a Fire Hydrant within a San Miguel polygon.  It always returns "Unknown" (0 code) for Lemon Grove, El Cajon, La Mesa, and Lakeside.  For San Diego, I noticed some strange behavior where it works in one part of the polygon, but consistently returns "Unknown" (0 code) in another.  In the screenshot below, anywhere to the right of the dark black line (used for illustration only - not part of the Fire District polygon geometry) inside the San Diego Fire District returns "Unknown" in the 'locationdetails' attribute.  Anywhere to the left of the black line returns "San Diego".  If I move the point from left to right of the black line area (or vice versa) the 'locationsdetails' attribute value changes from "San Diego" to "Unknown" or vice versa.

My question has two parts.  Does my code seem correct?  What could explain the odd behavior with the San Diego polygon intersection?

I've tested these features in a file geodatabase and everything works fine.  I thought perhaps it could be corrupt polygon geometry, but even after repairing the geometry, it behaves this way in the Enterprise Database.

Could it be that Arcade has difficulty interpreting the intersection between an Enterprise Geodatabase Feature Class (Fire District polygon) and a published Feature Service Feature Class (Fire Hydrant point)?  Or, the other possibility being that the polygon feature class does not have ZM values but the point feature class does?  Both have the same coordinate system using same Datum.

SH_HD_2-1718054881290.png

 

SH_HD_1-1718054740704.png

Domain values:

SH_HD_3-1718054913914.png

 

SH_HD_4-1718054937384.png

Hydrants labeled with their 'locationdetails' value:

SH_HD_5-1718054962216.png

SH_HD_6-1718055152877.png

 

Thanks for any help or troubleshooting thoughts you can provide!

 

 

0 Kudos
2 Replies
clt_cabq
Occasional Contributor III

I've only used intersect in a few instances, but I know the help docs indicate there is a scale dependency that will impact your results, have you looked at that as a possible culprit?

0 Kudos
SH_HD
by
New Contributor

Thank you for that suggestion.  I'll check into it and do some testing with my data.  I don't have any scale dependencies set in my map in ArcGIS Pro, but it's worth exploring for sure.  🙂

0 Kudos