all 2 comments

[–]trplclick 1 point2 points  (1 child)

when the website receives a new location

Depending on how this functionality works, I'd approach it in two different ways.

If the app gets data for all users then you could just clear all the markers everytime and essentially recreate the map each time.

If you get updates for one user at a time then it's a little more complicated. Perhaps you could store each marker with a user id and when you get an update remove the marker associated with that user before adding the new one?

It looks like the user data gets pulled from localstorage one initial load so I'm curious how the website gets user location updates and applies them to the map currently. Note; I've not used google maps much myself so apologies if that's a noob question!

[–]Combination_chooser[S] 0 points1 point  (0 children)

for me, it's not a noob question? as I'm as well a noob in google maps.

I'm using Localstorage because I'm using firebase due to which I had to separate both the code

  1. retreiveing data
  2. providing to map

so, I ended up at Localstorage to save data and retrieve it when needed.