I have two shapefiles: the first with a series of polygons that overlap; the second with a series of polygons that don't overlap. I need to separate the first ones according to the line of the second, keeping the overlapping polygons separated.
Graphically:
This is the initial situation: the shapefile contains several polygons that overlap and each polygon can be crossed by a line of a polygon that is in another shapefile (the red rectangles in the picture)
What I need to obtain at the end are the old polygons splitter according to the red one. In the example each polygon will be divided in two parts:
- 1a will be the yellow on the left + the green part;
- 1b will be the yellow on the right + the orange part;
- 2a will be the grey on the left + the green part;
- 2b will be the grey on the right + the orange part.
What I tried is to use the union tool and then the dissolve tool: with the first one I obtain six different polygons (one different polygon for each line that cross, no matter if it comes from the red polygon or the overlapping one).
Then I tried to dissolve indicating as "dissolve fields" the FID of the original two layers (FID_shp1 and FID_shp2) but basically nothing happened.
Any suggestion? should I use something different? I mean, is there a way to avoid that the overlapping lines became a separator and only the "red lines" are taken into consideration?
EDIT 1: Just to make the comprehension easier. This is the initial situation:
Each of this polygons can be crossed by other polygons that are in another shapefile
I need to arrive at the end at this situation
i.e. four different polygons that basically are the initial polygons divided by the red line of the polygons of the other shapefile.
The problem with the union tool are two-fold:
- The union tool take all the lines as a separator, included the ones of the overlapping polygons;
- Once I unified, the attributes of the second file are not copied but it will be transformed in something different (for example, all the FID of the second shapefile became -1. That's why maybe the dissolve tool doesn't work properly).