Hello all,
I'm getting an unusual error while trying to use the Intersects() function on an attribute rule in our Enterprise Geodatabase (10.9.1).
For a bit of background, the company I work for has a database of point features that represent the location of Cultural heritage items. When a new site is appended, we need to check if the site ID is a duplicate, and if the site being entered is in the same location as an existing site.
The duplicate site ID check using a filter is working fine, but I am getting the error "Arcade error: search geometry cannot be null, script line 9" when I try to save the attribute rule.
I have checked the input feature class for points with Null geometry and removed a few stragglers, I've also tried swapping out the FeaturesSetByName for another fc in our database, but I'm still getting the same error.
I've also tried guarding against nulls by nesting the count of intersects in an IIf statement that checks for an empty result when the existing_ahims_sites variable is called.
Any help would be greatly appreciated.
// reference the sites database
var existing_ahims_sites = FeatureSetByName($datastore, "gdb.owner.fd_nsw_ch_cultural_heritage_site_point", ['niche_id']);
var new_ahims_id = $feature.niche_id;
//check for intersects
var intersect_count = 0
intersect_count = Count(Intersects(existing_ahims_sites, $feature))
//set the intersect result to a default value
var intersection_result = "Intersection check was not conducted"
//query the output of the intersect check and update the result variable
IIf (intersect_count > 1, intersection_result = "Site intersects existing point", intersection_result = "Site does not intersect existing point")
//check for duplicate site IDs
var duplicate_check = filter(existing_ahims_sites, "niche_id = @new_ahims_id")
//guard against null results
var duplicate_count = 0
var duplicate_count = Count(duplicate_check)
//set the duplicate ID result to a default value
var id_check = "ID check was not conducted";
//query the output of the duplicate check and update the result variable
IIf (duplicate_count > 1, id_check = "Site id already in database.", id_check = "site ID not found in database")
//combine the results
var site_validation_result = Concatenate([id_check, intersection_result], '; ')
return site_validation_result
It's hard to tell what the error could be, because there is no code in line 9 in your code. Please try the code below and post the error message if you get one.
Things I noticed:
// reference the sites database
var existing_ahims_sites = FeatureSetByName($datastore, "gdb.owner.fd_nsw_ch_cultural_heritage_site_point", ["niche_id"])
var new_ahims_id = $feature.niche_id
//check for intersects
var intersect_count = Count(Intersects(existing_ahims_sites, $feature))
//query the output of the intersect check and set the result variable
var intersection_result = IIf(intersect_count > 1, "Site intersects existing point", "Site does not intersect existing point")
//check for duplicate site IDs
var duplicate_count = Count(Filter(existing_ahims_sites, "niche_id = @new_ahims_id"))
//query the output of the duplicate check and set the result variable
var id_check = IIf(duplicate_count > 1, "Site id already in database.", "site ID not found in database")
//combine the results
var site_validation_result = Concatenate([id_check, intersection_result], "; ")
return site_validation_result
Hello,
Have you found a solution to this issue? I got the same error!
Cheers,
Haochun
Hey,
can you please post more info?
I am getting the same error when trying to run an expression in a Calculate Field. It errors out when trying to evaluate the "IIf (intersect_count > 1," giving the null geometry error. The only way around this was to do a "Select by Location" of all points that intersect with my polys, then run the calculate field but it is very slow....
I could also use "ADD SPATIAL JOIN" for this but it is also very slow...
Just checked, this error occurs when you try to do an Intersects() with null geometries.
Check your feature classes for empty geometries, for example with this Arcade expression in Calculate Field:
return IIf(Geometry($feature) == null, "NULL GEOMETRY", null)