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

Create getZoomFromCoordinates(lat, lon) #224

Merged
merged 8 commits into from
Dec 19, 2019

Conversation

nstjean
Copy link
Contributor

@nstjean nstjean commented Dec 18, 2019

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 and getPrecisionFromNum

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!

@jywarren
Copy link
Member

Ok awesome, let's increment the version number in package.json here so we can republish on NPM when it merges!

@nstjean
Copy link
Contributor Author

nstjean commented Dec 18, 2019

I think something messed up when I rebased and did a merge. I'll find whatever is causing the test failures

@nstjean
Copy link
Contributor Author

nstjean commented Dec 19, 2019

Apparently jasmine tests do not like let in functions! Finally figured that out and fixed it.

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
@nstjean
Copy link
Contributor Author

nstjean commented Dec 19, 2019

Since I was already looking at the testing and this hasn't been merged yet I added tests for my new functions. :)

@jywarren jywarren merged commit 894f4f9 into publiclab:main Dec 19, 2019
@jywarren
Copy link
Member

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!

@jywarren
Copy link
Member

I'll publish later today, or maybe @sagarpreet-chadha can, I forget if he has access?

@jywarren
Copy link
Member

Thanks!

@nstjean nstjean deleted the get-zoom-from-coordinates branch December 19, 2019 17:11
@nstjean
Copy link
Contributor Author

nstjean commented Dec 19, 2019

Ok thanks! I'll remember the numbering system next time. :)

@jywarren
Copy link
Member

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.

@jywarren
Copy link
Member

@jywarren
Copy link
Member

I just gave dependabot a bump so we'll see!

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.

Create getZoomFromCoordinates function
2 participants