#22830: GeoDjango dwithin errors when using django.contrib.gis.measure.D
--------------------------+--------------------------------------
     Reporter:  django@…  |                    Owner:  nobody
         Type:  Bug       |                   Status:  closed
    Component:  GIS       |                  Version:  1.6
     Severity:  Normal    |               Resolution:  invalid
     Keywords:            |             Triage Stage:  Unreviewed
    Has patch:  0         |      Needs documentation:  0
  Needs tests:  0         |  Patch needs improvement:  0
Easy pickings:  0         |                    UI/UX:  0
--------------------------+--------------------------------------

Comment (by django@…):

 Replying to [comment:1 claudep]:
 > The error message is pretty clear. As your objects are in geographic
 coordinates (geometry fields default to WGS84), you have to provide the
 distance as degree units. This is for example matching the PostGIS
 definition:
 > {{{
 > boolean ST_DWithin(geometry g1, geometry g2, double precision
 distance_of_srid);
 > }}}
 > `distance_of_srid` being degrees for WGS84. So the `5` that works in
 your example means 5 degrees, not 5 km!
 >
 > You could argue that !GeoDjango could automatically cast geographic
 fields to geometry types when distance is a `Distance` object. It is
 unfortunately not as smart currently. See #17635 for a similar feature
 request (but in the opposite direction).

 The error may be clear, but the cause isn't (which is why I had to submit
 this bug report). Either GeoDjango should correctly handle `Distance`
 objects in all cases, or the documentation should be edited to make it
 clear that `Distance` objects don't work in all cases. Since #17635 has
 been open for 2 years without any progress, I'd opt for the latter. I
 don't see anywhere in the documentation that even hints that `Distance`
 objects can't be used for the dwithin query in certain cases.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/22830#comment:2>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/079.2360dec35b394665e0c264a088975310%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to