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

Add/remove markers as zoom level change . #18

Closed
sagarpreet-chadha opened this issue Feb 5, 2019 · 11 comments
Closed

Add/remove markers as zoom level change . #18

sagarpreet-chadha opened this issue Feb 5, 2019 · 11 comments

Comments

@sagarpreet-chadha
Copy link
Collaborator

Reference : #9 (comment)

So does this make sense? That in this library, as you zoom in, some locations appear only within some zoom levels, that are close to the precision they were entered in? If they have lots of precision, they might appear in many zoom levels, but if they are very imprecise (highly blurred), they would be hidden once you zoom in too far.

We could write a test to check for this -- so it would start the map up, go to a certain zoom level, and check what's visible, then zoom in further and check again, for 3 or 4 zoom levels. Then we could write the functions of this library to ensure that the markers are properly displayed for those given zoom levels.

@sagarpreet-chadha
Copy link
Collaborator Author

Hi @jywarren !
Can you remove the CORS from our API for the time being ?

Currently we have hard-coded markers on map , so we can use /people API for now ? Thanks !

@sagarpreet-chadha
Copy link
Collaborator Author

So i was thinking of doing this by :

1.) Making a function which will get an array of locations as an input and depending upon the current zoom level , will only add markers that have the minimum precision .

  • What should be the relation between zoom level and precision here ? I guess it would be cool if we could sort of hard-code this , like

       if zoom level >=0 and  zoom level <=2 then show ALL MARKERS 
       if zoom level >=3 and  zoom level <=4 then show ALL MARKERS with precision>2
       and so on ...
    

2.) Now each time when the map is panned or moved , the API will again fetch the data . So remove ALL markers on map first , pass the new data to the above function again (point 1) . So each time new data is fetched , we call above function . Makes sense ?

@jywarren ...what do you think ?

@jywarren
Copy link
Member

jywarren commented Feb 5, 2019

@icarito can you see about enabling CORS for requests to /api/ on plots2? (@sagarpreet-chadha maybe you can reach out to icarito in chat if he needs more info?)

@jywarren
Copy link
Member

jywarren commented Feb 5, 2019

Yes, this makes sense - it's like a filter that accepts and outputs an array, and each API call we run the returned markers through it!

@jywarren
Copy link
Member

jywarren commented Feb 5, 2019

We can write a simple test to show that only the correct precisions are passed through the filter -- very test-able!

@sagarpreet-chadha
Copy link
Collaborator Author

What should be the logic to filter coordinates @jywarren ? Is the one i proposed above makes sense ? Thanks !

@jywarren
Copy link
Member

jywarren commented Feb 5, 2019 via email

@icarito
Copy link
Member

icarito commented Feb 6, 2019

I went to enable CORS but found - Access-Control-Allow-Origin : * - already present

@icarito
Copy link
Member

icarito commented Feb 6, 2019

maybe you mean to allow CORS in staging?

@icarito
Copy link
Member

icarito commented Feb 6, 2019

Just for consistency and in case it helps I've allowed CORS to our staging instances! Let me know if something more is needed.

@sagarpreet-chadha
Copy link
Collaborator Author

This was the error :
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at ... (Reason: CORS request not http).

It is working now @icarito . Thank you 😄 !

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

No branches or pull requests

3 participants