How to use the proj4.default.Proj 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 TerriaJS / terriajs / lib / Map / Reproject.js View on Github external
reprojectPoint: function(coordinates, sourceCode, destCode) {
    var source = new proj4.Proj(Proj4Definitions[sourceCode]);
    var dest = new proj4.Proj(Proj4Definitions[destCode]);
    return proj4(source, dest, coordinates);
  },
github TerriaJS / terriajs / lib / Models / ArcGisMapServerCatalogItem.js View on Github external
function getRectangleFromLayer(thisLayerJson) {
  var extent = thisLayerJson.extent;
  if (
    defined(extent) &&
    extent.spatialReference &&
    extent.spatialReference.wkid
  ) {
    var wkid = "EPSG:" + extent.spatialReference.wkid;
    if (!defined(proj4definitions[wkid])) {
      return undefined;
    }

    var source = new proj4.Proj(proj4definitions[wkid]);
    var dest = new proj4.Proj("EPSG:4326");

    var p = proj4(source, dest, [extent.xmin, extent.ymin]);

    var west = p[0];
    var south = p[1];

    p = proj4(source, dest, [extent.xmax, extent.ymax]);

    var east = p[0];
    var north = p[1];

    return Rectangle.fromDegrees(west, south, east, north);
  }

  return undefined;
github geosolutions-it / MapStore2 / web / client / utils / CoordinatesUtils.js View on Github external
getUnits: function(projection) {
        const proj = new Proj4js.Proj(projection);
        return proj.units || 'degrees';
    },
    reproject,
github TerriaJS / terriajs / lib / Models / ArcGisMapServerCatalogItem.js View on Github external
function getRectangleFromLayer(thisLayerJson) {
  var extent = thisLayerJson.extent;
  if (
    defined(extent) &&
    extent.spatialReference &&
    extent.spatialReference.wkid
  ) {
    var wkid = "EPSG:" + extent.spatialReference.wkid;
    if (!defined(proj4definitions[wkid])) {
      return undefined;
    }

    var source = new proj4.Proj(proj4definitions[wkid]);
    var dest = new proj4.Proj("EPSG:4326");

    var p = proj4(source, dest, [extent.xmin, extent.ymin]);

    var west = p[0];
    var south = p[1];

    p = proj4(source, dest, [extent.xmax, extent.ymax]);

    var east = p[0];
    var north = p[1];

    return Rectangle.fromDegrees(west, south, east, north);
  }

  return undefined;
}

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