Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cache and merge in new annotations with already loaded data #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

timwaters
Copy link
Member

This PR makes it so when annotation data is requested, it keeps, merges in, and removes duplicates with any existing data instead of just overwriting with new data. This means that a user, if they panned back to an area of the map they have already visited, should not see a few ms of no data while data is being requested and should see the previous style.

@embeepea
Copy link
Member

I think if we are going to do this, then we also need to have a way to remove annotations from memory that are outside the current view. Otherwise as the user pans around, memory usage could grow without bound, right?

@timwaters
Copy link
Member Author

Yeah, memory would grow as they pan around. We'd have to figure out how many objects a normal browser could handle. Some older ones would struggle more.
I imagine it would be possible to resize the annotation array to a set size, so that it keeps the most recently pushed objects (assumption is that they are geographically close to each other) and that resizing would work wrt memory, garbage collect etc.

Another way could be to only update the id array for the map and leave the annotations to be replaced as it is. If the user clicks on a polygon and the annotations hadn't been loaded yet, they wouldn't see any detail, so maybe there could be a new check for new info and re-populate the side panel, or just show a loading indicator until? The id array could be much larger but still wouldn't be able to have everything in it, I guess. Perhaps a loading indicator or refresh mechanism could be used for both approaches?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants