#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 --------------------------+-------------------------------------- Changes (by claudep):
* status: new => closed * needs_better_patch: => 0 * resolution: => invalid * needs_tests: => 0 * needs_docs: => 0 Comment: 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). -- Ticket URL: <https://code.djangoproject.com/ticket/22830#comment:1> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/079.fae887a8ba4c97ac2c3ef5f6cb7a1d49%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.