Skip to main content
added 17 characters in body
Source Link
DWynne
  • 2.4k
  • 11
  • 22

Use the geometry object's equals method. With polygons and polylines, if their symmetric difference is empty they are considered equal.

So for example, in the below, g2 is the same as g1, it just has an extra vertex in the middle, and g3 is opposite to g1, so always equal.

>>> g1 = arcpy.Polyline(arcpy.Array([arcpy.Point(1, 1), arcpy.Point(3, 3)]))
>>> g2 = arcpy.Polyline(arcpy.Array([arcpy.Point(1, 1), arcpy.Point(2, 2), arcpy.Point(3, 3)]))
>>> g3 = arcpy.Polyline(arcpy.Array([arcpy.Point(3, 3), arcpy.Point(1, 1)]))
>>> g1.equals(g2)
True
>>> g1.equals(g3)
True
>>> g2.equals(g3)
True

Use the geometry object's equals method. With polygons and polylines, if their symmetric difference is empty they are considered equal.

So for example, in the below, g2 is the same as g1, it just has an extra vertex in the middle, and g3 is opposite to g1.

>>> g1 = arcpy.Polyline(arcpy.Array([arcpy.Point(1, 1), arcpy.Point(3, 3)]))
>>> g2 = arcpy.Polyline(arcpy.Array([arcpy.Point(1, 1), arcpy.Point(2, 2), arcpy.Point(3, 3)]))
>>> g3 = arcpy.Polyline(arcpy.Array([arcpy.Point(3, 3), arcpy.Point(1, 1)]))
>>> g1.equals(g2)
True
>>> g1.equals(g3)
True
>>> g2.equals(g3)
True

Use the geometry object's equals method. With polygons and polylines, if their symmetric difference is empty they are considered equal.

So for example, in the below, g2 is the same as g1, it just has an extra vertex in the middle, and g3 is opposite to g1, so always equal.

>>> g1 = arcpy.Polyline(arcpy.Array([arcpy.Point(1, 1), arcpy.Point(3, 3)]))
>>> g2 = arcpy.Polyline(arcpy.Array([arcpy.Point(1, 1), arcpy.Point(2, 2), arcpy.Point(3, 3)]))
>>> g3 = arcpy.Polyline(arcpy.Array([arcpy.Point(3, 3), arcpy.Point(1, 1)]))
>>> g1.equals(g2)
True
>>> g1.equals(g3)
True
>>> g2.equals(g3)
True
Source Link
DWynne
  • 2.4k
  • 11
  • 22

Use the geometry object's equals method. With polygons and polylines, if their symmetric difference is empty they are considered equal.

So for example, in the below, g2 is the same as g1, it just has an extra vertex in the middle, and g3 is opposite to g1.

>>> g1 = arcpy.Polyline(arcpy.Array([arcpy.Point(1, 1), arcpy.Point(3, 3)]))
>>> g2 = arcpy.Polyline(arcpy.Array([arcpy.Point(1, 1), arcpy.Point(2, 2), arcpy.Point(3, 3)]))
>>> g3 = arcpy.Polyline(arcpy.Array([arcpy.Point(3, 3), arcpy.Point(1, 1)]))
>>> g1.equals(g2)
True
>>> g1.equals(g3)
True
>>> g2.equals(g3)
True