Search 10 nearest Locations in Datastore

后端 未结 3 688
离开以前
离开以前 2021-01-19 00:03

I have a lot of Entities containing geoPoints stored in Google\'s Datastore. Now I need to get the 10 nearest locations based on a Location sent to a Google Cloud Function.<

3条回答
  •  北荒
    北荒 (楼主)
    2021-01-19 00:20

    We run a geospatial-heavy service on AppEngine.

    Our solution is to store the locations on Memcache and doing the calculations directly instead of relying on the database.

    This obviously depends on the amount of locations, but if you are clever about how you store the locations, you can search very quickly.

    R-Trees are a very good example: https://en.wikipedia.org/wiki/R-tree

提交回复
热议问题