1

This question already has an answer here:

I have an ArcGis Desktop Standard license and I would like to perform an operation to find out the difference between 2 features classes geometries (Something like symmetrical difference in Arcgis advanced version). Unfortunately symmetrical difference is not available for Arcgis desktop standard. The operation should be performed using Arcpy. Has anyone a tip for me, how to perform such an operation on Arcgis Standard?

Thanks

marked as duplicate by PolyGeo, Devdatta Tengshe, user2856, Paul, Jason Scheirer May 26 '14 at 18:01

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Although not among the free functions, ET Geowizards can perform the same calculation (Symmetrical difference). I imagine it would still be a lot cheaper to buy that package than an andvanced license. It also supports scripting. – Martin May 26 '14 at 7:37
2

Couldn't you use Union then just remove the parts that overlap?

Create an "intersects" field in both input feature classes and assign a value 1 to all features on both feature classes. (Intersects_A in one feature class, Intersect_B in the other feature class)

Perform a Union

Query for Intersects_A = 1 AND Intersects_B = 1 and delete.

You should be left with a result equivalent to "symetrical difference"

Reference Image source: ArcGIS 10.2 Help enter image description here

2

It's possible in Python, but the resulting script would be significantly slower than the system tool. Geometry objects in arcpy have a .symmetricDifference method you could utilize.

import itertools
import os

import arcpy

def make_fc(fc_path, oid1_field, oid2_field):
    arcpy.management.CreateFeatureClass(os.path.dirname(fc_path),
                                        os.path.basename(fc_path),
                                        'POLYGON')
    arcpy.management.AddField(fc_path, oid1_field, 'LONG')
    arcpy.management.AddField(fc_path, oid2_field, 'LONG')

def calculate_symdiff(cur1, cur2, cur3):
    for row_combination in itertools.product(cur1, cur2):
        ((shape1, oid1), (shape2, oid2)) = row_combination
        symdiff = shape1.symmetricDifference(shape2)
        # Only output results that have an area
        if symdiff.area > 0:
            cur3.insertRow([symdiff, oid1, oid2])

def make_symdiff_table(fc1, fc2, out_fc, oid1_field='OID1', oid2_field='OID2'):
    make_fc(out_fc, oid1_field, oid2_field)
    with arcpy.da.SearchCursor(fc1, ('SHAPE@', 'OID@')) as fcur1, \
         arcpy.da.SearchCursor(fc2, ('SHAPE@', 'OID@')) as fcur2, \
         arcpy.da.InsertCursor(out_fc, ('SHAPE@', oid1_field,
                                        oid2_field)) as insert_cur:
        calculate_symdiff(fcur1, fcur2, insert_cur)

if __name__ == "__main__":
    make_symdiff_table(r"c:\data\old_regions.shp",
                       r"c:\data\new_regions.shp",
                       r"c:\data\region_area_differences.shp")
  • is this only for Polygon features? If so, how can I keep it general in order to process any kind of features types(point, line or polygon)? – diesher May 28 '14 at 5:44
  • 1
    This works on any two feature classes of the same type, so multipoint and polyline would work as well. – Jason Scheirer May 28 '14 at 13:36

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