Skip to content
This repository has been archived by the owner on Mar 28, 2022. It is now read-only.

Allow zoomInterval smaller than 0.5 #4

Open
megatom opened this issue Nov 15, 2018 · 5 comments
Open

Allow zoomInterval smaller than 0.5 #4

megatom opened this issue Nov 15, 2018 · 5 comments

Comments

@megatom
Copy link

megatom commented Nov 15, 2018

If i use a zoomInterval smaller than 0.5 the labels getting weird.
With 0.2 for example i get a label with 50.800000000000000001W instead of 50.8W.
Same for 0.1.

@srappel
Copy link

srappel commented Nov 18, 2018

Yes, I had to write some crazy modifications to the calculations before I could convert the labels to DMS. You can see my sloppy code on my Geodex repo. It's right in the graticule js file in the plugins folder.

@megatom
Copy link
Author

megatom commented Nov 19, 2018

I did a quick and dirty workaround for me, because i also wanted to have negative north values instaed of positive south values:

if(lat % 1 === 0) return '' + lat + 'N';
else return '' + lat.toFixed(2) + 'N';

This works for intervall 0.01 and bigger and i am fine with this.

Same for Longitude:
if(lng % 1 !== 0) lng = lng.toFixed(2);

@rasamimalala
Copy link

I already solve this issue in my pull request: #5

@megatom
Copy link
Author

megatom commented Apr 5, 2019

How can I access the complete changed file now?

@rasamimalala
Copy link

My pull request is not yet accepted. You can find a fork which containing my modification by following this link: https://github.com/tagip/Leaflet.Graticule

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

No branches or pull requests

3 participants