0

I have a polygon layer of watersheds and a point layer of tree planting locations. Because of privacy reasons, I can't display the exact location of tree plantings, so instead I'd like to display them in the center of whichever watershed they're in.

How do I go about this using ArcGIS Pro 2.7.

1
  • 1
    Do you want to change exact location of trees (in dataset) to center of the polygon or just visualize (without changing them in dataset)? Oct 5, 2021 at 15:25

2 Answers 2

1

I would use python and move the points to each watershed centroid. Start by intersecting your watersheds and plantings to transfer some watershed identifier to your point layer. Then:

import arcpy

watershed = r'C:\folder\data.gdb\watersheds' #Change
planting = r'C:\folder\data.gdb\planting_intersected_with_watersheds' #Change
watershed_id_field = r'watershedid' #Change

watershed_centroids = {row[0]:row[1] for row in arcpy.da.SearchCursor(watershed, [watershed_id_field, 'SHAPE@XY'])} #Dictionary of watershed id as key, and centroid xy as value
#Move each point
with arcpy.da.UpdateCursor(planting, [watershed_id_field, 'SHAPE@XY']) as cursor:
    for row in cursor:
        if row[0] in watershed_centroids:
            row[1] = watershed_centroids[row[0]]
            cursor.updateRow(row)
1

It appears that tree location layer (point) is not necessary when you have polygon feature of watershed. You can simply use polygon feature class of your watershed and use Feature To Point from the Data management toolbox. Simply uncheck the "Inside" option if it is checked, this way resultant point feature will be calculated at the center of gravity (centroid) of watershed polygon feature. The resulting points equal number of polygons in your input feature layer.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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