Opened 12 years ago

Closed 12 years ago

#18704 closed Bug (needsinfo)

Distance lookups fail when used with LIMIT statements

Reported by: Dan Loewenherz Owned by: nobody
Component: GIS Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

To repro, just create a geomanaged model and try the following statements.

Place.objects.filter(coordinates__distance_lte=(pnt, D(mi=2)))

Should work, with pnt being an arbitrary coordinate (Point). Now, try something like the following.

Place.objects.filter(coordinates__distance_lte=(pnt, D(mi=2)))[:3]

It will fail with "GEOSException: Error encountered checking Coordinate Sequence returned from GEOS C function".

Thanks!

Change History (4)

comment:1 by Claude Paroz, 12 years ago

Resolution: worksforme
Status: newclosed

I was not able to reproduce this error. You can find similar tests around https://github.com/django/django/blob/master/django/contrib/gis/tests/distapp/tests.py#L213. Reopen if you can provide more details to reproduce it.

comment:2 by Dan Loewenherz, 12 years ago

Resolution: worksforme
Status: closedreopened

Yes, those tests work fine, and like I said in the original description, regular distance lookups work perfectly.

However, they don't test limit queries, which is where the exception occurs. I'm pretty sure this is a query formatting issue, since the normal lookup works. If the normal lookup didn't work, I'd say it was a configuration error or something on my end.

I'll add a working test case in the next comment.

comment:3 by Claude Paroz, 12 years ago

I did add slicing in the aforementioned tests without generating any error, so I would be interested to read a failing test example.

comment:4 by Claude Paroz, 12 years ago

Resolution: needsinfo
Status: reopenedclosed

Still waiting for a failing test case...

Note: See TracTickets for help on using tickets.
Back to Top