Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getCenter: function(center, projection) {
const point = isArray(center) ? {x: center[0], y: center[1]} : center;
const crs = center.crs || projection || 'EPSG:4326';
const transformed = crs !== 'EPSG:4326' ? Proj4js.transform(new Proj4js.Proj(crs), epsg4326, point) : point;
return assign({}, transformed, {crs: "EPSG:4326"});
},
normalizeConfig: function(config) {
const reproject = (point, source, dest, normalize = true) => {
const sourceProj = source && Proj4js.defs(source) ? new Proj4js.Proj(source) : null;
const destProj = dest && Proj4js.defs(dest) ? new Proj4js.Proj(dest) : null;
if (sourceProj && destProj) {
let p = isArray(point) ? Proj4js.toPoint(point) : Proj4js.toPoint([point.x, point.y]);
const transformed = assign({}, source === dest ? numberize(p) : Proj4js.transform(sourceProj, destProj, numberize(p)), {srs: dest});
if (normalize) {
return normalizePoint(transformed);
}
return transformed;
}
return null;
};