How to use the proj4.default.defs 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 / components / mapcontrols / mouseposition / MousePosition.jsx View on Github external
getPosition = () => {
        let {x, y, z} = this.props.mousePosition ? this.props.mousePosition : [null, null];
        if (!x && !y) {
            // if we repoject null coordinates we can end up with -0.00 instead of 0.00
            ({x, y} = {x: 0, y: 0, z});
        } else if (proj4js.defs(this.props.mousePosition.crs) !== proj4js.defs(this.props.crs)) {
            ({x, y} = CoordinatesUtils.reproject([x, y], this.props.mousePosition.crs, this.props.crs));
        }
        let units = CoordinatesUtils.getUnits(this.props.crs);
        if (units === "degrees") {
            return {lat: y, lng: x, z};
        }
        return {x, y, z};
    };
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;
};
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;
};
github geosolutions-it / MapStore2 / web / client / utils / CoordinatesUtils.js View on Github external
function determineCrs(crs) {
    if (typeof crs === 'string' || crs instanceof String) {
        return Proj4js.defs(crs) ? new Proj4js.Proj(crs) : null;
    }
    return crs;
}
github geosolutions-it / MapStore2 / web / client / components / TOC / Toolbar.jsx View on Github external
render() {
        const status = this.getStatus();
        const currentEPSG = this.checkBbox();
        const epsgIsSupported = currentEPSG && Proj4js.defs(currentEPSG);

        const layerMetadataModal = ();
        return this.props.activateTool.activateToolsContainer ? (
            
                
                    {this.props.activateTool.activateAddLayer && (status === 'DESELECT' || status === 'GROUP') ?
github geosolutions-it / MapStore2 / web / client / utils / CoordinatesUtils.js View on Github external
isSRSAllowed: (srs) => {
        return !!Proj4js.defs(srs);
    },
    /**
github geosolutions-it / MapStore2 / web / client / components / app / StandardApp.jsx View on Github external
config.projectionDefs.forEach((proj) => {
                proj4.defs(proj.code, proj.def);
            });

proj4

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

MIT
Latest version published 29 days ago

Package Health Score

89 / 100
Full package analysis

Similar packages