开发者

How to store and search GeoData in AppEngine?

开发者 https://www.devze.com 2023-01-01 23:35 出处:网络
In my application, I want to store geographical data (longitude and latitude). Then I want to ask \"which place is in this region\". SQL-like query can\'t be used, since \"Inequalit开发者_C百科y Filte

In my application, I want to store geographical data (longitude and latitude). Then I want to ask "which place is in this region". SQL-like query can't be used, since "Inequalit开发者_C百科y Filters Are Allowed On One Property Only" in GQL link text

Do you know about another solution how to store these data in AppEngine database and ask for them with GQL?


I've had success using the geomodel open-source project for storing and querying lat/lon data in the App Engine datastore. It uses a geohash to enable querying on a single property, it's available for both Python and Java and since it's open source you can modify the code to fit your particular case if need be.

It's also worth noting that it was announced at Google I/O a couple weeks back that the datastore would someday (hopefully soon) provide native support for geospatial and date queries, using a Hilbert curve internally. This would allow fast querying for bounding box or even in arbitrary polygon queries. You can watch the video of that talk online for more detail, it's a pretty interesting discussion.


You can use Geohash to encode latitude and longitude into a single string, and then just use an ascending and descending property index to locate the nearest matches.

0

精彩评论

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