2

Using PostGis and GeoDjango with a model having a Geography field I'm trying to exclude results where the location is 0,0. I get the error PostGIS geography does not support the "exact" lookup. The only thing I can think to do is exclude points that are 0 meters from 0,0:

.exclude(location__distance_lte=(Point(0, 0), D(m=1)))

Is there a better way?

1 Answer 1

1

try this:

.exclude(location__intersects=Point(0, 0))

The intersects spatial lookup is one of the four available on geography column types in GeoDjango.

In PostGIS, ST_Intersects natively supports geography column types and has a tolerance of about 0.00001 metres.

More info:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.