How to filter Django GeopositionField based on longitude or latitude

289 views Asked by At

I have a geoposition field that contains lat,long value of a point.

>> object.location
>>11.23,21.23

>>object.location.latitude
 >> 11.23

I have tried

queryset.filter(location__latitude__lte=20.00) 

but its not working.

1

There are 1 answers

1
vlad On
from geoposition.fields import Geoposition

n = Geoposition(11.23, 21.23)
queryset.filter(location=n)