HOW TO
When working with local or global scenes in ArcGIS Pro, 2D layers can be represented with elevations on the map. Elevations can be rendered as a floating or underground feature relative to the ground. In some cases, elevated point features must be connected to a line feature for a visual representation of a standing structure, for example, a light pole or a power line on a street. This article provides the workflow to automatically generate a connecting vertical line based on an elevated point created on an existing line feature.


var lines = FeaturesetByName($datastore, "<Line_Feature>", ["GlobalID"], true)
var i_line = First(Intersects(lines, Buffer($feature, 1, "meters")))
if(i_line == null) { return }
var line_geo = Geometry(i_line)
var point_geo = Geometry($feature)
var d_start = Distance(point_geo, line_geo.paths[0][0])
var d_end = Distance(point_geo, line_geo.paths[-1][-1])
var i = IIf(d_start < d_end, 0, -1)
var v = [line_geo.paths[i][i].x, line_geo.paths[i][i].y, point_geo.z, null]
var new_point_geo = {x: v[0], y: v[1], z: v[2], m: v[3], spatialReference: point_geo.SpatialReference}
var new_line_geo = Dictionary(Text(line_geo))
var j = IIf(i == 0, 0, Count(new_line_geo.paths[0]))
Insert(new_line_geo.paths[0], j, v)
return {
result: { geometry: Point(new_point_geo) },
edit: [{
className: "<Line_Feature>",
updates: [{
globalID: i_line.GlobalID,
geometry: Polyline(new_line_geo)
}]
}]
}

Article ID: 000030799
Get help from ArcGIS experts
Start chatting now