Radius / diameter confusion in geolocation example
Author: robvandijkCreated Aug 3, 2026Updated Aug 30, 2026
Labelsdocsneeds triage
Checklist
- I've searched through the current issues to make sure this change hasn't been suggested already.
- I agree to follow the Code of Conduct that this project adheres to.
Which documents need updating?
https://leafletjs.com/examples/mobile/#geolocation
Motivation
The example has the line var radius = e.accuracy;.
When I adopted this in my own code, the circle shown was 2x too large.
Inspecting the code behind the example revealed that the JS code executes var radius = e.accuracy/2;
Suggested changes
The example text must be changed to incorporate the division by 2. Or, the JS code must be changed to remove the division by 2.
Looking at the definition of accuracy in https://w3c.github.io/geolocation/#latitude-longitude-and-accuracy-attributes I believe now that the JS code is in error.
Source: Leaflet/Leaflet