1

I have a line and some points along with line, but they are not equally distanced from line. I want to align them at equal distance along the line, let's say, every point should be at a distance of 10 meter from the line.

Problem Image

I want to make an Python script for this, but don't know where to start.

Vince
  • 20,017
  • 15
  • 45
  • 64
Akhil Kumar
  • 613
  • 5
  • 15
  • Have you tried http://gis.stackexchange.com/questions/1394/snapping-points-to-lines-in-arcgis-desktop-and-automate-using-vba? – Learner Feb 03 '16 at 09:07
  • Have you looked at Linear Referencing? – PolyGeo Feb 03 '16 at 09:09
  • i was trying to understand liner referencing what i could understand that it creates a new dbase table. and may not be useful to actually realign the points itself. – Akhil Kumar Feb 03 '16 at 09:16

1 Answers1

3

You could make a buffer along your line, then convert this buffer to polyline and finally use snap tool to snap points on this line. Python code should looks like this:

import arcpy

# Set workspace
arcpy.env.workspace = r"path_to_your_workspace"

# Set variables
line_feature = "your_line_feautre.shp"
point_feaure = "your_point_feature.shp"
distance_from_line = "10 Meters" # distance for buffer

buffer_feaure = "in_memory" + "\\" + "buffer" # temporary feature
line_from_buffer = "in_memory" + "\\" + "line" # temporary feauture

# Make buffer along line
arcpy.Buffer_analysis(line_feature, buffer_feaure, distance_from_line)

# Convert buffer to polyline
arcpy.PolygonToLine_management(buffer_feaure, line_from_buffer)

# Snap points to line
distance_for_snap = "20 Meters" # distance for include points to snap
arcpy.Snap_edit(point_feaure, [[line_from_buffer, "EDGE", distance_for_snap]])

# Delete
arcpy.Delete_management("in_memory")

You could see the help for tools: Buffer, Polygon to Line and Snap tool.

david_p
  • 1,783
  • 1
  • 19
  • 34