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:

Description

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 Matthias Kestenholz

Component: UncategorizedGIS
Keywords: nearest_to queryset added
Needs documentation: set
Owner: changed from nobody to Matthias Kestenholz
Status: newassigned
Version: SVNgis

comment:2 Changed 8 years ago by Matthias Kestenholz

Owner: Matthias Kestenholz deleted
Status: assignednew

comment:3 Changed 8 years ago by jbronn

Resolution: wontfix
Status: newclosed

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