Skip to content

0.8-dev L.circle with tiny radius renders wrongΒ #2425

Closed
@johnwillyn

Description

When creating a circle with a very small radius of 0.01 (m), Leaflet 0.8-dev renders it incorrectly. I tracked this down to the calculation of lngR in L.Circle._project an patched my version to use the old version of this calculation. I have not had a chance to debug the new calculation.

Here is the line and my patch to the old code:

                        lat2 = map.unproject(p).lat;
            //var lngR = latR / Math.cos(Math.PI / 180 * lat); //old way
            lngR = Math.acos((Math.cos(latR * d) - Math.sin(lat * d) * Math.sin(lat2 * d)) /
                    (Math.cos(lat * d) * Math.cos(lat2 * d))) / d;

And here is what it renders like in 0.8-dev:
screen shot 2014-01-30 at 9 20 04 am

I am doing testing of hi-precision GPS devices and this is how I test for 'cm' accuracy, so use these tiny radius circles to test results.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions