Opened 16 years ago

Closed 16 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: no UI/UX: no

Description

based on paulsmith's djangocodesnippet 190.

Attachments (1)

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

Download all attachments as: .zip

Change History (4)

by lkcl, 16 years ago

Attachment: f added

comment:1 by Matthias Kestenholz, 16 years ago

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

comment:2 by Matthias Kestenholz, 16 years ago

Owner: Matthias Kestenholz removed
Status: assignednew

comment:3 by jbronn, 16 years ago

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