Opened 8 years ago

Closed 8 years ago

#7934 closed (wontfix)

adding "nearest_to" search to geodjango

Reported by: lkcl Owned by:
Component: GIS Version: gis
Severity: Keywords: nearest_to queryset
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


based on paulsmith's djangocodesnippet 190.

Attachments (1)

f (2.9 KB) - added by lkcl 8 years ago.

Download all attachments as: .zip

Change History (4)

Changed 8 years ago by lkcl

  • Attachment f added

comment:1 Changed 8 years ago by mk

  • Component changed from Uncategorized to GIS
  • Keywords nearest_to queryset added
  • Needs documentation set
  • Needs tests unset
  • Owner changed from nobody to mk
  • Patch needs improvement unset
  • Status changed from new to assigned
  • Version changed from SVN to gis

comment:2 Changed 8 years ago by mk

  • Owner mk deleted
  • Status changed from assigned to new

comment:3 Changed 8 years ago by jbronn

  • Resolution set to wontfix
  • Status changed from new to closed

The existing distance API already has such functionality, for example the distance_lte and dwithin lookup types and/or using the distance GeoQuerySet method:

>>> from django.contrib.gis.geos import Point
>>> from django.contrib.gis.measure import D
>>> pnt = Point(x, y)
>>> qs = GeoModel.objects.filter(point__distance_lte=(pnt, D(mi=5))) # Find all objects w/in 5 miles of pnt
>>> qs = GeoModel.objects.distance(pnt).order_by('distance') # Ordered queryset by distance from pnt
Note: See TracTickets for help on using tickets.
Back to Top