#25342: Altitude of Point object for equality check
-------------------------------------+------------------------------------
     Reporter:  Bhargav Kowshik      |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  GIS                  |                  Version:  dev
     Severity:  Normal               |               Resolution:
     Keywords:  geodjango, equality  |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+------------------------------------

Comment (by Olivier Tabone):

 Prior 3.12.0, GEOS already has [https://github.com/libgeos/geos/pull/810
 multiple equality functions]:
 - `GEOSEquals` (which uses topological equality, returning true for
 different representations of the same structure)
 - `GEOSEqualsExact` (which uses pointwise equality, but allows for a
 distance tolerance and ignores Z/M values)

 currently, django uses
 [https://libgeos.org/doxygen/geos__c_8h.html#a23922c100edd72a8d82720213607e7bf
 GEOSEqualsExact] in the
 
[https://github.com/django/django/blob/95e4d6b81312fdd9f8ebf3385be1c1331168b5cf/django/contrib/gis/geos/geometry.py#L144
 __eq__() method] which is not a good fit regarding equality semantics when
 z is used (thus this ticket).

 `GEOSEquals()` does not work in 3D
 [https://libgeos.org/doxygen/geos__c_8h.html#a45499a7d87851015d36e57d285da9d8e
 as documented] which is not a good fit regarding equality semantics
 either.

 GEOS 3.12 introduces `GEOSEqualsIdentical` which is a good fit for
 python's equality semantic in 2D and 3D.

 I would suggest:
 - implementing the `GEOSGeometryBase.equals_identical()`  method,
 available if GEOS >= 3.12.0. That should be an easy call, pure additive.
 (new ticket ?)
 - raising a warning if `GEOSGeometryBase.__eq__()` is called with one
 operand having a third dimension (`geom.hasZ == True`). To fix this
 warning, one should either use an explicit comparaison method
 (`GEOSGeometryBase.equals()`,  `GEOSGeometryBase.equals_exact()`,
 `GEOSGeometryBase.equals_identical()`) or use a 2D point.
 - when GEOS 3.12 becomes the minimum supported version, use
 GEOSEqualsIdentical to perform  `GEOSGeometryBase.__eq__()`. This will
 give some time for one to adapt their code bases.

 What do you think ?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/25342#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018988e522c0-dc30aad8-e3b1-46d4-9eb8-0299699c44ec-000000%40eu-central-1.amazonses.com.

Reply via email to