Skip to main content
added 417 characters in body
Source Link
radouxju
  • 49.9k
  • 2
  • 71
  • 144

If you want to shift the entire feature using python, and more specifically arcpy.da.updateCursor(), you should apply the shift to the SHAPE@XY token and not to the SHAPE@TRUECENTROID token. This would need you to update each polygon indepently in a loop, but shouldn't destroy your topology if you apply exactly the same shift.

EDIT : thanks for the additional information

from what I see, you should merge your two polygons (e.g. using arcpy.dissolve_management), then compute the shift needed to place the merged polygon at the right place (X of AOI - X of merged polygon, Y of AOI - Y of merge polygon) and finally apply this shift to each individual polygon.

cursor.updateRow([[row[0][0] + (x_shift), row[0][1] + (y_shift)]])

If you want to shift the entire feature using python, and more specifically arcpy.da.updateCursor(), you should apply the shift to the SHAPE@XY token and not to the SHAPE@TRUECENTROID token. This would need you to update each polygon indepently in a loop, but shouldn't destroy your topology if you apply exactly the same shift.

If you want to shift the entire feature using python, and more specifically arcpy.da.updateCursor(), you should apply the shift to the SHAPE@XY token and not to the SHAPE@TRUECENTROID token. This would need you to update each polygon indepently in a loop, but shouldn't destroy your topology if you apply exactly the same shift.

EDIT : thanks for the additional information

from what I see, you should merge your two polygons (e.g. using arcpy.dissolve_management), then compute the shift needed to place the merged polygon at the right place (X of AOI - X of merged polygon, Y of AOI - Y of merge polygon) and finally apply this shift to each individual polygon.

cursor.updateRow([[row[0][0] + (x_shift), row[0][1] + (y_shift)]])

Source Link
radouxju
  • 49.9k
  • 2
  • 71
  • 144

If you want to shift the entire feature using python, and more specifically arcpy.da.updateCursor(), you should apply the shift to the SHAPE@XY token and not to the SHAPE@TRUECENTROID token. This would need you to update each polygon indepently in a loop, but shouldn't destroy your topology if you apply exactly the same shift.