How to use the proj4.default.transform function in proj4

To help you get started, we’ve selected a few proj4 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github geosolutions-it / MapStore2 / web / client / utils / ConfigUtils.js View on Github external
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) {
github geosolutions-it / MapStore2 / web / client / utils / CoordinatesUtils.js View on Github external
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;
};

proj4

Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.

MIT
Latest version published 1 month ago

Package Health Score

86 / 100
Full package analysis

Similar packages