Solved! Go to Solution.
def points_along_line(line_lyr, pnt_layer, pnt_dist): """ line_lyr (feature layer) - Single part line pnt_layer (feature layer) - Path to point feature class pnt_dist (integer) - Interval distance in map units to add points """ search_cursor = arcpy.da.SearchCursor(line_lyr, 'SHAPE@') insert_cursor = arcpy.da.InsertCursor(pnt_layer, 'SHAPE@') for row in search_cursor: for dist in range(0, int(row[0].length), pnt_dist): point = row[0].positionAlongLine(dist).firstPoint insert_cursor.insertRow([point])
if not arcpy.Exists(pnt_layer): arcpy.CreateFeatureclass_management( os.path.dirname(pnt_layer), os.path.basename(pnt_layer), 'POINT') ... return pnt_layer
points_along_line(line_features, point_features, pnt_dist) arcpy.SplitLineAtPoint_management(line_features, point_features, out_feature_class)
def points_along_line(line_lyr, pnt_layer, pnt_dist): """ line_lyr (feature layer) - Single part line pnt_layer (feature layer) - Path to point feature class pnt_dist (integer) - Interval distance in map units to add points """ search_cursor = arcpy.da.SearchCursor(line_lyr, 'SHAPE@') insert_cursor = arcpy.da.InsertCursor(pnt_layer, 'SHAPE@') for row in search_cursor: for dist in range(0, int(row[0].length), pnt_dist): point = row[0].positionAlongLine(dist).firstPoint insert_cursor.insertRow([point])
if not arcpy.Exists(pnt_layer): arcpy.CreateFeatureclass_management( os.path.dirname(pnt_layer), os.path.basename(pnt_layer), 'POINT') ... return pnt_layer
points_along_line(line_features, point_features, pnt_dist) arcpy.SplitLineAtPoint_management(line_features, point_features, out_feature_class)
Coincidentally, this exact same topic came up in ArcPy Café the other week: Split into equal length features. A team member Dave (I don't know him other than his name is Dave) provided a fairly compact and elegant solution.
All I am trying to do is highlight a line segment and have to user click somewhere on the line and split it into two segments....user define split.
EDIT: Trying to do this in an ArcGIS online app or a written JavaScript app.
You should really post this question in the ArcGIS API for JavaScript area.
Just realized that and just did that…thanks
Thanks
Jay
Jay Kapalczynski
GIS Coordinator - Virginia Department of Game & Inland Fisheries
(new address) 7870 Villa Park Drive Suite 400, Henrico VA 23228
Phone: 804.367.6796 | Fax: 804.367.2628
ü Please consider the environment before printing this email.