From what I remember, it wasn't easy. But I got it working with django-nonrel using GeoManager and geoutilsman functions. I update the GeoCells on the entities upon saving. I query with a Bounding Box
Some snippets:
model:
latitude = models.FloatField(_('latitude'), default=0,blank=True, null=True)
longitude = models.FloatField(_('longitude'), default=0,blank=True, null=True)
location_geocells=fields.ListField(models.CharField(max_length=15),null=True,blank=True) #
objects = GeoManager() # Bring in other class objects for geomodel
Usage
from geoutilsmain.geotypes import Point
from functions.panafunctions import get_bounding_box
..
center_point = Point(latitude, longitude)
logging.info("GEO search. Point: "+str(center_point)+" Radius: "+str(radius))
mybox=get_bounding_box(latitude, longitude, radius) # 10: half side in miles
north=mybox.lat_max # Jon verified defs of north vs lat
south=mybox.lat_min
west=mybox.lon_min
east=mybox.lon_max
logging.info("Bounding box co-ords: North: "+str(north)+" East: "+str(east)+" South: "+str(south)+" West: "+str(west))
query_results=conceptdb.objects.within(north, east, south, west,max_results=limit)# within(north, east, south, west)
myarray=QuerySetToDict(query_results)
..
def update_geocells(self):
"""Syncs underlying geocell properties with the entity's location.
Updates the underlying geocell properties of the entity to match the
entity's location property. A put() must occur after this call to save
the changes to App Engine."""
if self.latitude and self.longitude:
max_res_geocell = geocell.compute(self.location)
self.location_geocells = [max_res_geocell[:res]
for res in
range(1, geocell.MAX_GEOCELL_RESOLUTION + 1)]
else:
self.location_geocells = []