On May 28, 5:52 pm, Ariel Nunez <ingenieroar...@gmail.com> wrote: > On Thu, May 28, 2009 at 4:12 PM, nbv4 <cp368...@ohio.edu> wrote: > > > I have this model: > > ------------------------ > > from django.contrib.gis.db import models > > > class Base(models.Model): > > identifier = models.CharField(max_length=8, > > primary_key=True) > > local = models.CharField(max_length=8) > > iata = models.CharField(max_length=8) > > name = models.CharField(max_length=96) > > location = models.PointField() > > > ------------------------ > > *This(or similar) may work:* > > * > * > > >>>from django.contrib.gis.gdal.envelope import Envelope > >>>bbox=Envelope((-104.609252, 29.763374, -95.23506, 38.971823)) > > *>>>Base.objects.filter(location__intersects=bbox)* > > Ariel.
doesn't seem to work :( >>> W = 39.9; N = -82.9; E=40.4; S=-82.2 >>> bounds = Envelope((N, W, S, E, )) >>> Base.objects.filter(location__intersects=bounds) Traceback (most recent call last): File "<console>", line 1, in <module> File "/var/lib/python-support/python2.6/django/db/models/ manager.py", line 102, in filter return self.get_query_set().filter(*args, **kwargs) File "/var/lib/python-support/python2.6/django/db/models/query.py", line 489, in filter return self._filter_or_exclude(False, *args, **kwargs) File "/var/lib/python-support/python2.6/django/db/models/query.py", line 507, in _filter_or_exclude clone.query.add_q(Q(*args, **kwargs)) File "/var/lib/python-support/python2.6/django/db/models/sql/ query.py", line 1258, in add_q can_reuse=used_aliases) File "/var/lib/python-support/python2.6/django/db/models/sql/ query.py", line 1119, in add_filter elif (value == '' and lookup_type == 'exact' and File "/var/lib/python-support/python2.6/django/contrib/gis/gdal/ envelope.py", line 78, in __eq__ raise OGRException('Equivalence testing only works with other Envelopes.') OGRException: Equivalence testing only works with other Envelopes. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---