HOW TO
In ArcGIS Pro, it is possible to automatically generate point features at the endpoint of line features when line features are added to the map. This functionality can be implemented using an attribute rule that triggers when a line feature is added. Automating this process ensures consistent data generation and minimizes the risk of human error.
This article provides the workflow to automatically generate point features at the endpoint of line features using an attribute rule in ArcGIS Pro.
Note: An ArcGIS Pro Standard license or higher is required to create and manage attribute rules.
Note: The feature layer requires Global IDs to add an attribute rule.
var point_class = "<Field_Name>";
function get_endpoints(line) { var geom = Geometry(line); if (Count(geom["paths"]) > 0) { var last_point = Point(Geometry(line)["paths"][-1][-1]); return [last_point]; } return []; }
var new_points = []; var endpoints = get_endpoints($feature);
if (Count(endpoints) > 0) { for (var idx in endpoints) { push(new_points, { 'geometry': endpoints[idx] }); } }
if (Count(new_points) == 0) { return; }
var edit_payload = [{ 'className': point_class, 'adds': new_points }]; return { "edit": edit_payload }
The code below shows the example of the full working script:
var point_class = "Test_point"; function get_endpoints(line) { var geom = Geometry(line); if (Count(geom["paths"]) > 0) { var last_point = Point(Geometry(line)["paths"][-1][-1]); return [last_point]; } return []; } var new_points = []; var endpoints = get_endpoints($feature); if (Count(endpoints) > 0) { for (var idx in endpoints) { push(new_points, { 'geometry': endpoints[idx] }); } } if (Count(new_points) == 0) { return; } var edit_payload = [{ 'className': point_class, 'adds': new_points }]; return { "edit": edit_payload }
The following image shows point features are automatically generated at the endpoints of newly created line features.
Article ID: 000034800
Get help from ArcGIS experts
Download the Esri Support App