Python GeoModel 替代方案
我正在寻找一个用于应用程序引擎数据存储的替代库,它将执行最近的 n 或盒装地理查询,目前我正在使用 GeoModel 0.2,它运行得很慢(在某些情况下> 1.5 秒)。有人有什么建议吗?
谢谢!
I'm looking for an alternative library for the app engine datastore that will do nearest-n or boxed geo-queries, currently i'm using GeoModel 0.2 and it runs quite slow ( > 1.5s in some cases). Does anyone have any suggestions?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我对地理模型也有同样的问题。
为了纠正它,我使用分辨率 4,并使用 python 排序和过滤器。
I have a same problem with geomodel.
For correct it, i use a resolution of 4 and i use a python sorted and filter.
不要使用 geomodel 0.2.0 版本,而是使用 withasync 分支(请参阅
http://code.google.com/p/geomodel/source/browse/#svn/branches/withasync)。这将允许您使用 asynctools 并行运行查询,这对于许多查询来说将显着加快。
确保您的 app/pythonpath 中也有 asynctools。
Instead of using the geomodel 0.2.0 release, use the withasync branch (see
http://code.google.com/p/geomodel/source/browse/#svn/branches/withasync). This will let you run the queries in parallel using asynctools, which will be significantly faster for many queries.
Be sure you have asynctools in your app/pythonpath as well.
我无法向您指出具有更好性能的现有库,但我记得,GeoModel 是开源的,并且代码并不难理解。我们发现可以通过调整代码以适应我们的场景来提高速度。
例如,如果您不需要nearest-n,您只需要特定边界框或半径内的X结果,您可能可以提高GeoModel的速度,因为GeoModel当前必须获取适当的geohash中的每条记录,然后进行排序记忆中最接近的。 (该实现的详细信息留给读者作为练习。)
您还可以考虑调整正在使用的 geohash 级别。如果您有大量密集数据并且正在小范围内查询,则可以通过保留 16 个级别而不是 8 个或 12 个级别来显着提高性能。
(我现在没有查看 GeoModel 源代码,但回想起我上次使用它时的情况)几个月前,所以请对此持保留态度并亲自深入研究源代码。)
I can't point you to an existing library that has better performance, but as I recall, GeoModel is open source and the code isn't difficult to understand. We found that we could make some speed improvements by adjusting the code to fit our scenario.
For example, if you don't need nearest-n, you just need X results from within a particular bounding box or radius, you can probably improve GeoModel's speed, as GeoModel has to currently get every record in the appropriate geohash and then sorts for closest in memory. (Details of that implementation left as an exercise for the reader.)
You might also consider tuning how many levels of geohash you're using. If you have a lot of dense data and are querying over small areas, you might considerably increase performance by keeping 16 levels instead of 8 or 12.
(I'm not looking at the GeoModel source right now but recalling when I last used it several months ago, so take this with a grain of salt and dive into the source code yourself.)