Select point(s) from given coordinate and move to new coordinate using arcpy

المشرف العام

Administrator
طاقم الإدارة
Goal: Move address points to their correct location.

Plan: I have a layer of AddressPoints of which some need moved to a new location. I want to take a line layer (called AddressPoints_AdjustLocation, shown as a purple dashed line below) and draw a line from the address points current location (which is usually close to the road) to the desired location (which is the front door of the building)



Code I have so far:

arcpy.MakeFeatureLayer_management("../pathToAddressPoints", "lyr_AddressPoints") arcpy.MakeFeatureLayer_management("../pathToAddressPoints_AdjustLocation, "lyr_AddressPoints_AdjustLocation") # Create a cursor that holds all the selected AdjustLocation features rows = arcpy.SearchCursor("lyr_AddressPoints_AdjustLocation") if rows: for row in rows: feat = row.getValue("SHAPE") vertex_list = [] for vertex in feat.getPart(0): if vertex: vertex_list.append([vertex.X, vertex.Y]) vertexStart = vertex_list[0] # TODO: Select all address points in "lyr_AddressPoints" that intersect the vertexStart location vertexEnd = vertex_list[-1] # TODO: For each address point selected above, move it to the vertexEnd locationThe 2 items I need help with are how to select address points that Intersect the vertexStart position, and then moving those address points to the vertexEnd location (using UpdateCursor I assume...)

Thanks for your time!Jason



أكثر...
 
أعلى