Ticket #115 (feature request)
Opened 2 years ago
Last modified 2 years ago
Shapely: add __eq__ and __ne__ to BaseGeometry
Status: closed (fixed)
| Reported by: | fredj | Assigned to: | seang |
|---|---|---|---|
| Priority: | trivial | Milestone: | |
| Component: | Data Stores and Sources | Version: | |
| Keywords: | Cc: | ||
Index: shapely/geometry/base.py
===================================================================
--- shapely/geometry/base.py (revision 752)
+++ shapely/geometry/base.py (working copy)
@@ -168,6 +168,12 @@
overlaps = BinaryPredicate(lgeos.GEOSOverlaps)
equals = BinaryPredicate(lgeos.GEOSEquals)
+ def __eq__(self, other):
+ return self.equals(other)
+
+ def __ne__(self, other):
+ return not self.equals(other)
+
# Unary predicates
#
# These use descriptors to reduce the amount of boilerplate.
Use case:
>>> from shapely.geometry.point import Point >>> a = Point(2,4) >>> b = Point(2,4) >>> a == b True >>> a.x += 2 >>> a == b False
Change History
07/10/07 03:05:53: Modified by fredj
- type changed from defect to feature request.
07/10/07 10:57:56: Modified by seang
- status changed from new to closed.
- resolution set to fixed.

Good idea. Committed in r753.