I assume it might have something to do with the number of records
I got the same error for Multipoints with only 1 point, so I don't think that's it.
My first idea was that it had something to do with the SpatialReference, because you don't set that when creating the Multipoints, but that didn't work either.
My tests suggest that something is buggy with constructed Multipoints.
def layer_to_multipoint(layer, wkid=None):
"""Reads the geometries of a point layer and returns a Multipoint geometry.
If wkid is set, the Multipoint will be projected into that system.
"""
in_sr = arcpy.Describe(layer).spatialReference
coordinates = [row[0] for row in arcpy.da.SearchCursor(layer, ["SHAPE@XY"])]
points = [arcpy.Point(*c) for c in coordinates]
multipoint = arcpy.Multipoint(arcpy.Array(points), spatial_reference=in_sr)
if wkid:
out_sr = arcpy.SpatialReference(wkid)
multipoint = multipoint.projectAs(out_sr)
return multipoint
# construct a MP geometry from a point layer
constructed_mp = layer_to_multipoint("TestPoints")
# try to run some geometry functions on it
constructed_mp.symmetricDifference(constructed_mp) # ERROR
constructed_mp.union(constructed_mp) # ERROR
constructed_mp.difference(constructed_mp) # works
constructed_mp.intersect(constructed_mp, 1) # works
# write the constructed mp into a fc and read it again from there
with arcpy.da.InsertCursor("TestMultipoints", ["SHAPE@"]) as cursor:
cursor.insertRow([constructed_mp])
read_mp = [r for r in arcpy.da.SearchCursor("TestMultipoints", ["SHAPE@"])][0][0]
# try to run the geometry functions on the read mp
read_mp.symmetricDifference(read_mp) # works
read_mp .union(read_mp) # works
read_mp .difference(read_mp) # works
read_mp .intersect(read_mp , 1) # works
# let's compare the mp's
print(constructed_mp.JSON)
#{"points":[[81359.018400000408,5906093.2276000008],[81356.343299999833,5906139.3099000007],[81519.05449999962,5905955.2974999994]],"spatialReference":{"wkid":25833,"latestWkid":25833}}
print(read_mp.JSON)
#{"points":[[81359.018400000408,5906093.2276000008],[81356.343299999833,5906139.3099000007],[81519.05449999962,5905955.2974999994]],"spatialReference":{"wkid":25833,"latestWkid":25833}}
It seems like these are the same Multipoints, but somehow union and symmetricDifference fail for the mp I constructed myself. It also didn't matter whether I used the functions, the operators, or the Geometry._arc_object functions.
I think I remember you posting a huge script containing this snippet. Did it work back then? I think this is a matter for tech support.
In the meantime, there's Symmetrical Difference...
Have a great day!
Johannes