biodiv / anycluster

Server-side clustering of map markers for (Geo)Django

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Join on field 'location' not permitted.

clime opened this issue · comments

I am getting this exception:

FieldError at /anycluster/grid/2/64/
Join on field 'location' not permitted. Did you misspell 'within' for the lookup type?

at this point:

File "/srv/www/cwu/anycluster/clusterer.py" in gridCluster
  697.                     pin_count = Gis.objects.filter(Q_filters).count()

Here are local vars at that point (idk if useful):

gridSize    
64
filters 
[]
self    
<anycluster.clusterer.MapClusterer instance at 0x7fc24834bc68>
Q_filters   
<django.db.models.query_utils.Q object at 0x7fc24830a510>
zoom    
2
poly    
'POLYGON((-0.000000 -21.943046, -0.000000 -40.979898, -22.500000 -40.979898, -22.500000 -21.943046, -0.000000 -21.943046))'
clustercells    
set([10,10', '10,11',  '10,12', ...])
cell    
'7,6'
cell_topright   
<Point object at 0x7fc2482d7370>
lookup  
'location__within'
gridCells   
[]
kwargs  
{}
srid_db 
4326
cell_bottomleft 
<Point object at 0x7fc2482d7250>

location field in my db is a PointField that stores coordinates (lng, lat) of a point.

on your django model which contains the PointField, have you added

objects = models.GeoManager()

?

so it looks something like this:

class GEODJANGO_MODEL(models.Model):
    location = models.PointField(srid=4326)
    objects = models.GeoManager()

Ah, you are right. Forgot that. Thank you!