-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPointAttributeRule2
31 lines (24 loc) · 1.14 KB
/
PointAttributeRule2
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
30
31
// This Attribute Rule add a junction if the deleted point is coincident to a line
// Set the trigger on Delete
//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 new_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
//Make variables for all line feature classes you want included
var pipe = FeatureSetByName($datastore, "olympia_utility.DBO.waPipe", ['OBJECTID'], true) //***Replace name here
//Check to see if the point being deleted intersects with the line feature class
var doesIntersect = first(Intersects(Geometry($feature), pipe))
//If the deleted point intersected with a line, add a junction
if (doesIntersect !=null)
{
push(new_points, {'geometry': Geometry($feature)})
}
//Now, actually add the point
var edit_payload = [{
'className': point_class,
'adds': new_points
}]
return {
"edit": edit_payload
}