You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 10, 2019. It is now read-only.
Is there a way to query the nearest item stored in dyanmoDB with a given geo point? Let's assume that we have 50k items of interests stored in dynamoDB and i need to find the closet one with the given geo point. What is the best way to accomplish this?
The text was updated successfully, but these errors were encountered:
After having implemented a proximity search utilizing pieces of the API
(which is nothing more than the radius search in the example customized
with our data and business logic). It would seem to me the simplest way
find the closest point would to write your own version of the filter used
in GeoDataManager.
In GeoDataManger the filter method handles both rectangle and radius
searches. If the request is for a radius search it
Determines the S2LatLng of the center point and the radius used for the
query.
For each item returned from the geo query:
Create a S2LatLng object from the result.
If the distance between the result and the center point is less than or
equal to the given radius add it to the results.
You would just have to change the return logic a bit (this time in pseudo
code for easier reading).
if SHORTEST_DISTACE is null
SHORTEST_DISTANCE = CURRENT_DISTANCE
ITEM_TO_RETURN = RESULT
else if CURRENT_DISTANCE is less than SHORTEST_DISTANCE
SHORTEST_DISTANCE = CURRENT_DISTANCE
ITEM_TO_RETURN = RESULT
Take note of the getEarthDistance method in S2LatLng. All you have to do is
utilize that method to determine the shortest distance and the return
object.
Is there a way to query the nearest item stored in dyanmoDB with a given
geo point? Let's assume that we have 50k items of interests stored in
dynamoDB and i need to find the closet one with the given geo point. What
is the best way to accomplish this?
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/3
.
Is there a way to query the nearest item stored in dyanmoDB with a given geo point? Let's assume that we have 50k items of interests stored in dynamoDB and i need to find the closet one with the given geo point. What is the best way to accomplish this?
The text was updated successfully, but these errors were encountered: