-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPointAttributeRule
29 lines (23 loc) · 1.08 KB
/
PointAttributeRule
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// This Attribute Rule removes a junction if it's coincident to the new/moved point
// Set the trigger on both Insert and Update
//global variables, the feature class you want to insert junctions into, and an empty array of points
var point_class = "Olympia_Utility.DBO.Water_geoNet_Junctions" //***Replace name here
var remove_points = [];
//Make variables for junctions. For some reason, I can't use the variable point_class here
var junctions = FeatureSetByName($datastore, "Olympia_Utility.DBO.Water_geoNet_Junctions", ['OBJECTID'], true); //***Replace name here
//Check to see if the new point intersects with any of the junction feature class
var doesIntersect = first(Intersects(Geometry($feature), junctions));
//If there's an intersection with the new point, remove the junction
if (doesIntersect !=null)
{
// Add the intersecting junction's objectID to the list to remove
push(remove_points, {'objectID': doesIntersect.objectID})
}
//Now, actually remove the point
var edit_payload = [{
'className': point_class,
'deletes': remove_points
}]
return {
"edit": edit_payload
}