开发者

Django and GeoSpatial Queries on Google App Engine - How to overcome the 'one inequality per query' issue?

I've just began to use the GAE and I have stumbled upon an issue which has let me questioning the feasibility of using Django on GAE.

All I'm trying to do is a simple query with Django's ORM:

addresses = Address.objects.filter(lat__gte=form.cleaned_data['north_east_lat'])
addresses = addresses.filter(lat__lte=form.cleaned_data['south_west_lat'])
addresses开发者_如何学JAVA = addresses.filter(lon__gte=form.cleaned_data['north_east_lon'])
addresses = addresses.filter(lon__lte=form.cleaned_data['south_west_lon'])

But apparently it's not that easy with Bigtable:

BadFilterError: invalid filter: Only one property per query may have inequality filters (<=, >=, <, >)..

How can I get around this issue? (Using Django's ORM preferably)


Unfortunately, I don't know of an easy way to use Django's ORM to get around this issue. However, you can do geospatial queries on GAE (including bounding box queries like you're doing in your example). For details, please check out the Geospatial Queries with Google App Engine using GeoModel article.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜