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.
Domain values:
Hydrants labeled with their 'locationdetails' value:
Thanks for any help or troubleshooting thoughts you can provide!
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?
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. 🙂
Did you ever come to any resolution on this? I'm curious if referencing the domain codes in the script vs the description makes any difference in your results.