How to cut and merge many polygons at once

3830
24
01-24-2020 12:57 PM
by Anonymous User
Not applicable

I was wondering if there was a way to cut polygons using polygons from a different layer as boundaries. And then merging the cut polygons within those boundaries, while preserving attributes of whichever poly had the bigger area.

Basically the goal is to realign the blue and pink layer to the new boundaries(Green Lines)

24 Replies
JohnJones
Esri Contributor

Another, potentially faster, way of doing this, without any splits or merges, would be based on pairing polygons. 

Say you want to align polygons in the 'red' layer to the 'green' layer (for lack of better terminology) one way is to find a label point for each green and red polygon (Feature to Point, inside), for every red point (corresponding to a red polygon) find the nearest green point and match the corresponding polygons (red polygon to the green polygon which has a label point closest to the red polygon's label point) and then transfer the geometry of the green polygon to the red polygon. 

For safety you can verify that the mapping is one to one (no to red polygons choose the same green one) and flag any red polygons that match to a conflicting green polygon (you could merge them if desired).  If the shifts are large, the label points may shift too much and this won't work well, but if it works it is considerably less work than a bunch of splits & merges.

by Anonymous User
Not applicable

Good idea! I will give that a shot. So after using the feature to point tool on both layers would I use a python script to find the nearest nearest point of the other layer? 

0 Kudos
deleted-user-NvcfpBOWaKwr
Occasional Contributor

Just to make sure I understand correctly. Essentially what you would like to do is update the geometry of the old parcel boundary layer (blue and pink) with the geometry of the new parcel boundary's (green)

If this is the case then we can make a pretty simple script that can update the geometry of the old layer with the new geometry while preserving the original attributes. Let me know if that is essentially what you are looking to do.

0 Kudos
by Anonymous User
Not applicable

Unfortunately thats not the case. This layer needs the geometry of the green layer but does not have the same attributes. However they do have matching unique ids (APN)

0 Kudos
deleted-user-NvcfpBOWaKwr
Occasional Contributor

Alright. So the attribute information for the polygon with the largest area after the clip is what you would still keep. If it feels like we are talking in circles, my apologies. Just wanted to make sure I fully understand and to make sure there wasn't possibly an easier solution.

Are you able to share the field names for original layer and the new boundary layer? Tonight Ill start writing up a tool for you to use in pro.

0 Kudos
by Anonymous User
Not applicable

Thank you very much I really appreciate it. Here are the attributes where Layer A needs the geometry of Layer B. Let me know if there's anything else I can provide

Layer A

  • APN
  • LAND_CODE1
  • Reso_nmbr
  • CNTRL_NMBR
  • DATE_ADOPT
  • PROJECT
  • LANDUSE_1
  • created_user
  • created_date
  • last_edited_user
  • last_edited_date
  • Shape.STArea()
  • Shape.STLength()

Layer B

  • Shape
  • GID
  • APN
  • APN_DASH
  • APN10
  • BOOK
  • PAGE
  • BLOCK
  • PARCEL
  • ACTION
  • COMMENTS
  • INSERT_DATE
  • PCN_CREATED_BY
  • PCN_DELETED_BY
  • WSTATUS
  • UPDATE_BY
  • UPDATE_DATE
  • PRCL_KEY
  • Shape_Length
  • Shape_Area
0 Kudos
deleted-user-NvcfpBOWaKwr
Occasional Contributor

Do you by any chance know what flavor of DB layer A is stored in? MS SQL?

0 Kudos
by Anonymous User
Not applicable

Yes sql

0 Kudos
deleted-user-NvcfpBOWaKwr
Occasional Contributor

Are you able to export the information in the SQL database to a File Geodatabase? The reason why I'm asking is because I'm reluctant to write code to change information in a SQL database that could be a production database that other services or applications might depend on.

If you were able to export the information into a File Geodatabase we could essentially use that as a test / development database that wouldn't impact anything if something goes wrong. Then once all of the changes have been made and deemed correct you could talk to your DBA about pushing those updates to the SQL database.

Maybe I'm over reacting, however this is how we set up things like this where I work. We setup a Development / Staging Environment then push it to the production environment once everything has been vetted as correct.

by Anonymous User
Not applicable

Yes that is the same way we operate as well. And yes I can export it to a file geodatabase for testing

0 Kudos