Hello:

     I'm trying to get up on GeoDjango, but I can't get lookups to work at
all. All geographic operations via the GeoManager -- filter, exclude, get --
fail with the same error: "Operations on two geometries with different
SRIDs."
     Strangely, though, I'm perfectly able to perform geometric operations
like "intersects," "touches," "contains," etc., outside the GeoManager. And
I'm pretty sure that the geometries in question don't have different SRIDs
because they come from the same model.
     Here's a typical shell session. The first error listed is an IPython
error -- I don't think that's it, because it fails the same way in the plain
Python shell, but I'll leave it here in case I'm missing something.
     Probably I'm doing something extremely boneheaded.  Any ideas?

     Thanks in advance,

     Hank Sims


In [1]: from gistest.watershed.models import River

In [2]: river0=River.objects.all()[0]

In [3]: river1=River.objects.all()[1]

In [4]: river0.line.touches(river1.line)
Out[4]: True

In [5]: river0.line.srid
Out[5]: 4326

In [6]: River.objects.filter(line__touches=river0.line)
Out[6]:
---------------------------------------------------------------------------
<class 'psycopg2.ProgrammingError'>       Traceback (most recent call last)

/home/hanksims/gis_projects/gistest/<ipython console> in <module>()

/var/lib/python-support/python2.5/IPython/Prompts.py in __call__(self, arg)
    521
    522             # and now call a possibly user-defined print mechanism
--> 523             manipulated_val = self.display(arg)
    524
    525             # user display hooks can change the variable to be
stored in

/var/lib/python-support/python2.5/IPython/Prompts.py in _display(self, arg)
    545         """
    546
--> 547         return self.shell.hooks.result_display(arg)
    548
    549     # Assign the default display method:

/var/lib/python-support/python2.5/IPython/hooks.py in __call__(self, *args,
**kw)
    132             #print "prio",prio,"cmd",cmd #dbg
    133             try:
--> 134                 ret = cmd(*args, **kw)
    135                 return ret
    136             except ipapi.TryNext, exc:

/var/lib/python-support/python2.5/IPython/hooks.py in result_display(self,
arg)
    160
    161     if self.rc.pprint:
--> 162         out = pformat(arg)
    163         if '\n' in out:
    164             # So that multi-line strings line up with the left
column of

/home/hanksims/gis_projects/gistest/pprint.py in pformat(self, object)
    109     def pformat(self, object):
    110         sio = _StringIO()
--> 111         self._format(object, sio, 0, 0, {}, 0)
    112         return sio.getvalue()
    113

/home/hanksims/gis_projects/gistest/pprint.py in _format(self, object,
stream, indent, allowance, context, level)
    127             self._readable = False
    128             return
--> 129         rep = self._repr(object, context, level - 1)
    130         typ = _type(object)
    131         sepLines = _len(rep) > (self._width - 1 - indent -
allowance)

/home/hanksims/gis_projects/gistest/pprint.py in _repr(self, object,
context, level)
    193     def _repr(self, object, context, level):
    194         repr, readable, recursive = self.format(object, context.copy
(),
--> 195                                                 self._depth, level)
    196         if not readable:
    197             self._readable = False

/home/hanksims/gis_projects/gistest/pprint.py in format(self, object,
context, maxlevels, level)
    205         and whether the object represents a recursive construct.
    206         """
--> 207         return _safe_repr(object, context, maxlevels, level)
    208
    209

/home/hanksims/gis_projects/gistest/pprint.py in _safe_repr(object, context,
maxlevels, level)
    290         return format % _commajoin(components), readable, recursive
    291
--> 292     rep = repr(object)
    293     return rep, (rep and not rep.startswith('<')), False
    294

/usr/lib/python2.5/site-packages/django/db/models/query.py in __repr__(self)
    106
    107     def __repr__(self):
--> 108         return repr(self._get_data())
    109
    110     def __len__(self):

/usr/lib/python2.5/site-packages/django/db/models/query.py in
_get_data(self)
    484     def _get_data(self):
    485         if self._result_cache is None:
--> 486             self._result_cache = list(self.iterator())
    487         return self._result_cache
    488

/usr/lib/python2.5/site-packages/django/db/models/query.py in iterator(self)
    187
    188         cursor = connection.cursor()
--> 189         cursor.execute("SELECT " + (self._distinct and "DISTINCT "
or "") + ",".join(select) + sql, params)
    190
    191         fill_cache = self._select_related

/usr/lib/python2.5/site-packages/django/db/backends/util.py in execute(self,
sql, params)
     16         start = time()
     17         try:
---> 18             return self.cursor.execute(sql, params)
     19         finally:
     20             stop = time()

<class 'psycopg2.ProgrammingError'>: Operation on two geometries with
different SRIDs

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to