1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #26920 -- Made GEOSGeometry equality check consider the srid

This commit is contained in:
Jackie Leng
2016-11-23 09:23:06 +01:00
committed by Claude Paroz
parent 10d49b96e6
commit 50613d957a
8 changed files with 56 additions and 15 deletions

View File

@@ -174,12 +174,14 @@ class GEOSGeometry(GEOSBase, ListMixin):
def __eq__(self, other):
"""
Equivalence testing, a Geometry may be compared with another Geometry
or a WKT representation.
or an EWKT representation.
"""
if isinstance(other, six.string_types):
return self.wkt == other
if other.startswith('SRID=0;'):
return self.ewkt == other[7:] # Test only WKT part of other
return self.ewkt == other
elif isinstance(other, GEOSGeometry):
return self.equals_exact(other)
return self.srid == other.srid and self.equals_exact(other)
else:
return False