How to use the proj4/dist/proj4.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 KlausBenndorf / guide4you / src / configurators / MapConfigurator.js View on Github external
let scaleIcons = mapConfigCopy.hasOwnProperty('scaleIcons') ? mapConfigCopy.scaleIcons : 1
    stylingOptions.scaleIcons = scaleIcons

    this.map_.set('scaleIcons', scaleIcons)
    this.map_.set('styling', new Styling(stylingOptions))

    // //////////////////////////////////////////////////////////////////////////////////////// //
    //                                      Projections                                         //
    // //////////////////////////////////////////////////////////////////////////////////////// //

    let additionalProjectionsConf = mapConfigCopy.hasOwnProperty('additionalProjections')
      ? mapConfigCopy.additionalProjections
      : []

    for (let i = 0, ii = additionalProjectionsConf.length; i < ii; i++) {
      proj4.defs(additionalProjectionsConf[i].code, additionalProjectionsConf[i].definition)
    }

    if (additionalProjectionsConf.length > 0) {
      register(proj4)
    }

    let mapProjection
    if (!mapConfigCopy.hasOwnProperty('mapProjection')) {
      Debug.warn('map should have set a `mapProjection`. Assuming default `EPSG:3857`.')
      mapProjection = getProj('EPSG:3857')
    } else {
      mapProjection = getProj(mapConfigCopy.mapProjection)
    }
    this.map_.set('mapProjection', mapProjection)

    let interfaceProjection = mapConfigCopy.hasOwnProperty('interfaceProjection')

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