1

I'm using ArcMap.

I have two identical point feature classes, one snapped to a line and the other not. Each point represents a telecommunication pole and the line represents fiber optic cable. I sequence the poles to the fiber optic cable line using the 'Route Events GeoProcessing Wizard' which by design, snaps all points to the fiber cable. I then have to manually snap the points that don't belong on the fiber line manually, which is very time consuming. Is there a way to snap two identical point feature classes with unique ID's together, instead of snapping based off proximity?

  • Do the Points have an ID or other field that has the same value to identify identical Points? One point is now moved and the other point is at the original position. – klewis Oct 24 '16 at 21:48
  • Yes, each point has has a unique ID field. The two point feature classes are replicas of each other except one has all the poles snapped to the line. There may be 80 poles I need snapped to their original location while leaving the remaining poles snapped to the line. – GIS_GOD Oct 26 '16 at 15:23
1

You can move geometries using da.UpdateCursor:

pt_on_line = 'orginal_points'
pt_on_line_ID = 'FID' # common ID field
pt_off_line = 'points_to_move'
pt_off_line_ID = 'FID' # common ID field
pt_on_line_dict = {str(row[0]):row[1] for row in arcpy.da.SearchCursor(pt_on_line,[pt_on_line_ID,"SHAPE@"])} # make dictionary, like {ID:geometry}
with arcpy.da.UpdateCursor(pt_off_line,[pt_off_line_ID,"SHAPE@"]) as cursor:
    for row in cursor: # loop through points
        row[1] = pt_on_line_dict[str(row[0])] # move point geometry to match point geometry from dictionary
        cursor.updateRow(row) # update the geometry

Of course, Python is for consenting adults. This will move your data, so you may want to test on a backup.

  • I appreciate you taking the time to write out this script. Would you know of a place I can read on how to actually put this to use inside ArcMap? – GIS_GOD Oct 31 '16 at 12:42
  • 1
    I run small scripts like this in the Python Window in ArcMap. This is a good starting point for help: desktop.arcgis.com/en/arcmap/latest/analyze/arcpy/… – phloem Oct 31 '16 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.