jieter / Leaflet-semicircle

Extend Leaflet's circle class to display semicircles.
http://jieter.github.io/Leaflet-semicircle/examples/semicircle.html
MIT License
121 stars 52 forks source link

In areas close to the poles, the semi-circle becomes huge #12

Open JoeMatulka opened 7 years ago

JoeMatulka commented 7 years ago

In areas with coordinates like: 77N, 70W The circle object itself behaves fine, but when I use the set Direction function on the circle; it becomes huge.

This is only in issue in areas close to the poles.

My code is pretty straight forward:

                if (stopAngle < startAngle) {
                    stopAngle += 360;
                }

                var arc = stopAngle - startAngle;
                var direction = (arc) / 2 + startAngle;

                circle.setDirection(direction, arc);
jieter commented 7 years ago

Hey @JoeMatulka, thanks for the issue report. Bigger than normal circles? A fiddle describing your problem would be helpful, as your example code is not clearly showing the problem to me.

jieter commented 7 years ago

This example has a semicircle at 77N (zoom out a bit), it looks like I would expect.

JoeMatulka commented 7 years ago

What version of leaflet is that example using?

I should have mentioned I'm using 1.0.1

circles-semi-1 circles-semi-2

Those screens are the same circle, one just has the direction set with the code above.

This might be a version issue? Because Leaflet 1.x made circles more elliptical, possibly?

I should also mention, thank you for your work on this library. Very simple to use and clean :smiley:

JoeMatulka commented 7 years ago

Sorry about accidentally closing this issue, I believe that maybe this isn't an issue with the version of leaflet. But the projection of the map, I am using L.CRS.EPSG4326 which gives more of an elliptical view.