MichaelSolati/geofirestore-js

Best way to track moving locations?

Closed this issue · 1 comments

I'm looking to use your library to track things that are moving (ie, cars/people/etc) and to find other things that are nearby. From what I can gather, your library seems to be primarily designed to handle stationary things with a single moving search location.

If my understanding is correct, how would you advise using your library to track moving things?

I think I will need to keep track of each thing's current location hash so that I can remove the old one and create a new one when the thing moves.

Thanks for any advice.
Glenn.

I feel like there are a few ways this could be done, however this isn't really an issue, so I'd be inclined to close it. A question like this would probably be better for stack overflow.

If you know what you're tracking you could just attach a onSnapshot listener to an individual doc and use that to change to query what's near it (I'd use a get for that as you won't need to worry about killing a subscription considering you'll likely make a lot of requests for what's near by).

Also consider applying a threshold for how far a user needs to move before you requery.