Dissolving Features from different Layers

المشرف العام

Administrator
طاقم الإدارة
I'm trying to dissolve polygon features from different layers by their FID. If two polygons have the same FID the result should be one single polygon. Maybe this drawing will help to make clear what I'm trying to get:

Here's how I was going to proceed:First I performed a Union of the two layers joining only the FIDs. Thus I got a new layer with an attribute table containing two fields (called FID_Layer1 and FID_Layer2) with the initial FID of each layer and the value -1 if the polygon is from the respective other layer. Then I tried to add a new field combining those two fields but erasing the negative values and replacing them with the actual value. Based on this field I am going to perform a Dissolve hoping that it will give me the results I want.In order to get the new field on which to perform the Dissolve I wrote a script in Python:

def FID_Union(inValue):if !FID_Layer1! < 0: return !FID_Layer2!else: return !FID_Layer1!However, this doesn't work. The error message tells me that there's a syntax error in Line 2 but I can't figure out what's wrong.

So can anybody tell me what I have to change in the script to make it work?Or is there another (easier) way to dissolve the polygons from different layers? I'd be happy about any suggestions.



أكثر...
 
أعلى