使用 Google App Engine 的 GeoModel - 查询
我正在尝试使用 GeoModel python 模块快速访问我的 Google App Engine 应用程序的地理空间数据。 对于我遇到的问题,我只有一些一般性问题。 有两个主要方法:proximity_fetch 和bounding_box_fetch,可用于返回查询。它们实际上返回一个结果集,而不是一个过滤查询,这意味着您需要在传入过滤查询之前完全准备好它。它还限制您迭代查询集,因为结果是获取的,并且您没有将偏移量输入到获取中的选项。
如果不修改代码,任何人都可以推荐一个在查询中指定偏移量的解决方案吗?我的问题是,我需要根据变量检查每个结果,看看是否可以使用它,否则将其丢弃并测试下一个。我可能会遇到需要进行额外获取的情况,但从偏移量开始。
I'm trying to use GeoModel python module to quickly access geospatial data for my Google App Engine app.
I just have a few general questions for issues I'm running into.
There's two main methods, proximity_fetch and bounding_box_fetch, that you can use to return queries. They actually return a result set, not a filtered query, which means you need to fully prepare a filtered query before passing it in. It also limits you from iterating over the query set, since the results are fetched, and you don't have the option to input an offset into the fetch.
Short of modifying the code, can anyone recommend a solution for specifying an offset into the query? My problem is that I need to check each result against a variable to see if I can use it, otherwise throw it away and test the next. I may run into cases where I need to do an additional fetch, but starting with an offset.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您还可以直接使用模型的
location_geocells
。You can also work directly with the
location_geocells
of your model.没有实际的方法可以做到这一点,因为对 geoquery 的调用会分解为多个数据存储查询,并将这些查询合并到一个结果集中。如果您能够指定偏移量,geoquery 在返回您请求的结果之前仍然必须获取并丢弃所有前 n 个结果。
更好的选择可能是修改 geoquery 以支持游标,但每个查询都必须返回一组游标,而不是单个游标。
There's no practical way to do this, because a call to geoquery devolves into multiple datastore queries, which it merges together into a single result set. If you were able to specify an offset, geoquery would still have to fetch and discard all the first n results before returning the ones you requested.
A better option might be to modify geoquery to support cursors, but each query would have to return a set of cursors, not a single one.