3

I am carrying out a piece of work in ArcGIS 10.4.1 that involves realigning polygons to an updated vector map. The polygons in question are planning permission boundaries that are created showing the outline of the property the planning permission request refers to. Over a number of years a single property can have had multiple polygons drawn to reflect the different planning applications made against it. These polygons have been drawn by various different people over the years and depending on how accurate they were whilst creating them, they may have missing or extra vertices or no longer match the updated vector map due to changes in the the most recent mapping updates.

I am looking for a quicker way to achieve this than editing the individual polygons. Ideally what I would like to do is define a polygon shape created from my new base map layer and replace the geometry of all the planning permissions in one go. I do not know if this is possible but I have approx 60,000 polygons that potentially need replacing / realigning to new geometry and I cannot see an end in sight doing these individually!

Edited to include screenshot, In this screenshot, the red polygons is the planning layer, I need to align these polygons with the geometry of the green vector map, in this screenshot I have four misdrawn polygons that need to be redrawn to match the green vector map....

enter image description here

  • Could you add a screenshot to make your question easier to understand? – BERA Nov 8 '18 at 13:50
1

Assuming that you can relate your incorrect polygons to the definitive one via an attribute key, you can use arcpy to accomplish this. I have done something similar to maintain a parcel dataset that I use because I've noticed that our county periodically will update several blocks of parcels, seemingly for accuracy purposes and I wanted to catch those changes.

Here is my code:

def update_parcel_geometry(SWU_Parcels, Update_Parcels):

    #create parcel geometry dictionaries d1, d2
    cursor_fields = ['PID','SHAPE@','OID@']
    #dicts have index 0 as key and tuple of remainder as value
    arcpy.AddMessage('Reading SWU parcel geometries ...')
    with arcpy.da.SearchCursor(SWU_Parcels,cursor_fields) as cursor:
        d1 = {tup[0]:tup[1:] for tup in cursor}
    arcpy.AddMessage('Reading Update parcel geometries ...')
    with arcpy.da.SearchCursor(Update_Parcels,cursor_fields) as cursor:
        d2 = {tup[0]:tup[1:] for tup in cursor}

    #create dict of updated geoemetries
        # format { PID : SHAPE }
    update_dict = {t[0]: t[1][0] for t in d2.items() if t[0] in d1 and t[1][0] != d1[t[0]][0]}

    #create update cursor
    upd_fields = ['PID','SHAPE@','LAST_MODIFIED_BY','LAST_MODIFIED_DATE']
    with arcpy.da.UpdateCursor(SWU_Parcels,upd_fields) as upd_cursor:
        #commit updates
        for row in upd_cursor:
            if row[0] in update_dict:
                last_modified_by = 'ParcelScript'
                last_modified_date = datetime.datetime.now()
                PID = row[0]
                SHAPE = update_dict[row[0]]
                try:
                    update = (PID,SHAPE,last_modified_by,last_modified_date)
                    upd_cursor.updateRow(update)
                    arcpy.AddMessage('Updating geometry for PID {}'.format(row[0]))
                except Exception as e:
                    arcpy.AddMessage(e.args[0])

Note that accessing the polygon geometry via the SHAPE@ token is resource intensive, and storing a bunch of polygon geometries in memory might not work if you have a lot of them. I run this on about 100,000 parcels and sometimes it fails due to lack of memory, but I have only about 3 gb available.

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.