-
Notifications
You must be signed in to change notification settings - Fork 992
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
Imperial Area Calculations #320
Comments
The conversion from metric to imperial can be seen here: https://github.com/Leaflet/Leaflet.draw/blob/master/src/ext/GeometryUtil.js#L32 The method for calculating an area on a sphere is based off here: http://trs-new.jpl.nasa.gov/dspace/handle/2014/40409 Could you give some example of where the actual area is out by 30%? |
It's the number of acres that is off. I've just been using metric, getting the hectares then converting to acres. I'll take some screenshots when I have time! |
I have an example field that is suppose to be ~160 acres. The default code calculates it incorrectly incorrect But doing this then makes it correct since the metric area appears to be good. // area *= 0.836127; // Square yards in 1 meter
//
// if (area >= 3097600) { //3097600 square yards in 1 square mile
// areaStr = (area / 3097600).toFixed(2) + ' mi²';
// } else if (area >= 4840) {//48040 square yards in 1 acre
// areaStr = (area / 4840).toFixed(2) + ' acres';
// } else {
// areaStr = Math.ceil(area) + ' yd²';
// }
areaStr = (area * 0.0001 * 2.47105).toFixed(2) + ' acres'; |
well that was easy! Thanks! |
Awesome stuff @huaruiwu! Silly bug from me :( I was converting from metres to yards incorrectly. |
no problem. Thanks for all the leaflet work. It's great! |
Hi, Just wanted to let you know that the Imperial area calculations are off by quite a bit. Around 30%
The text was updated successfully, but these errors were encountered: