Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
tmatch = tgtPrj.match(axisPattern);
// if the two projections only differ in the middle axis
if (smatch && tmatch && smatch[1] === tmatch[1] && smatch[3] === tmatch[3]) {
for (i = coordinates.length - 3 + 1; i >= 0; i -= 3) {
coordinates[i] *= -1;
}
return coordinates;
}
var src = proj4.Proj(srcPrj),
tgt = proj4.Proj(tgtPrj),
projPoint, initPoint = {};
for (i = coordinates.length - 3; i >= 0; i -= 3) {
initPoint.x = +coordinates[i];
initPoint.y = +coordinates[i + 1];
initPoint.z = +(coordinates[i + 2] || 0.0);
projPoint = proj4.transform(src, tgt, initPoint);
coordinates[i] = projPoint.x;
coordinates[i + 1] = projPoint.y;
coordinates[i + 2] = projPoint.z === undefined ? initPoint.z : projPoint.z;
}
return coordinates;
};
export function wgs84ToMercator(point) {
var sourceCRS = proj4.Proj('EPSG:4326');
var destCRS = proj4.Proj('EPSG:3857');
var pt = new proj4.toPoint([point[1], point[0]]);
proj4.transform(sourceCRS, destCRS, pt);
return pt;
}
export function calcBboxFromXY(point, zoomLevel) {