Merge pull request #9060 from ahocevar/coordinate-convenience

Avoid unexpected behavior when passing string coordinates
This commit is contained in:
Andreas Hocevar
2018-12-14 09:36:12 +01:00
committed by GitHub
4 changed files with 17 additions and 3 deletions

View File

@@ -40,8 +40,8 @@ import {padNumber} from './string.js';
* @api
*/
export function add(coordinate, delta) {
coordinate[0] += delta[0];
coordinate[1] += delta[1];
coordinate[0] += +delta[0];
coordinate[1] += +delta[1];
return coordinate;
}

View File

@@ -106,7 +106,7 @@ export function fromEPSG4326(input, opt_output, opt_dimension) {
for (let i = 0; i < length; i += dimension) {
output[i] = halfSize * input[i] / 180;
let y = RADIUS *
Math.log(Math.tan(Math.PI * (input[i + 1] + 90) / 360));
Math.log(Math.tan(Math.PI * (+input[i + 1] + 90) / 360));
if (y > halfSize) {
y = halfSize;
} else if (y < -halfSize) {