﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
26920	GEOSGeometry objects compare equal despite different SRID	Raphael Das Gupta	nobody	"Checking equality of two `django.contrib.gis.geos.Point` objects (and presumably any other `GEOSGeometry` objects of equal type) does not take the geometries' SRIDs into consideration:

{{{#!python
from django.contrib.gis.geos import Point

p0 = Point(5, 23)  # SRID implicitly None
p1 = Point(5, 23, srid=4326)
p2 = Point(5, 23, srid=32632)

assert p0.srid != p1.srid  # passes
assert p0.srid != p2.srid  # passes
assert p1.srid != p2.srid  # passes

assert p0 != p1  # AssertionError
assert p0 != p2  # AssertionError
assert p1 != p2  # AssertionError
}}}


The semantic of coordinates depends completely on the spatial reference system. The same numbers refer to completely different positions when interpreted in different coordinate systems. Therefore, I think the geometries should compare unequal if both have an SRID set and those SRIDs are different. Not sure what should happen when comparing geometries where exactly one of them has an SRID.

If the currently observed behaviour is the intended one (or if it is retained for backwards compatibility reasons), the documentation should point that out. [https://docs.djangoproject.com/en/1.9/ref/contrib/gis/geos/#geometries-are-pythonic It already points out that the ""Equality operator doesn’t check spatial equality""], but to me that only made clear that spatial equality does not imply `GEOSGeometry` object equality, but not that neither does `GEOSGeometry` object equality imply spatial equality. Also, [https://docs.djangoproject.com/en/1.9/ref/contrib/gis/geos/#django.contrib.gis.geos.GEOSGeometry.equals equals()], which is mentioned in that admonition as an alternative, doesn't seem to care about SRID, either:
{{{#!python
assert not p0.equals(p1)  # AssertionError
assert not p0.equals(p2)  # AssertionError
assert not p1.equals(p2)  # AssertionError
}}}"	Cleanup/optimization	closed	GIS	dev	Normal	fixed	geodjango, equality	Sergey Fedoseev Claude Paroz jackie.leng@…	Ready for checkin	1	0	0	0	0	0
