-
Notifications
You must be signed in to change notification settings - Fork 32
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
Create getZoomFromCoordinates(lat, lon) #224
Conversation
37ea713
to
d88fafd
Compare
Ok awesome, let's increment the version number in package.json here so we can republish on NPM when it merges! |
I think something messed up when I rebased and did a merge. I'll find whatever is causing the test failures |
Apparently jasmine tests do not like I also changed the version to 1.4.1 instead of 1.3.2 based on your instructions in publiclab/plots2#6887 :) |
…es, getZoomFromCoordinates, getZoomByPrecision
Since I was already looking at the testing and this hasn't been merged yet I added tests for my new functions. :) |
Oh sorry usually the final digit goes to 0 again so 1.4.0, I misspoke when explaining it! No big deal here though. Thanks! |
I'll publish later today, or maybe @sagarpreet-chadha can, I forget if he has access? |
Thanks! |
Ok thanks! I'll remember the numbering system next time. :) |
no prob, it was my mistake! OK - published it! You can try bumping the version manually downstream now, OR dependabot can be triggered to recommend it and open a PR. |
I just gave dependabot a bump so we'll see! |
Fixes #222
Function takes in a lat and lon and calculates the appropriate zoom level based on the precision of the lat and lon. Returns zoom.
For edge case of lat and lon having a different precision level I checked both lat and lon and took the highest one. I used helper functions
getPrecisionFromCoordinates
andgetPrecisionFromNum
I also added precisionTable to the API options so an override object can be passed in. The default object currently is:
var default_precision_table = {'-2': 2, '-1': 3, '0': 6, '1': 10, '2': 13, '3': 16};
This can later be changed if we decide we want a different format!