Loading lib/Point.js +1 −24 Original line number Diff line number Diff line Loading @@ -23,30 +23,7 @@ function Point(x, y, z) { this.y = y; this.z = z || 0.0; } this.clone = function() { return new Point(this.x, this.y, this.z); }; this.toArray = function(){ if(this.z){ return [this.x,this.y, this.z]; }else{ return [this.x,this.y]; } }; this.toString = function() { if(this.z){ return "x=" + this.x + ",y=" + this.y + ",z="+this.z; }else{ return "x=" + this.x + ",y=" + this.y; } }; this.toShortString = function() { if(this.z){ return this.x + "," + this.y+ "," + this.z; }else{ return this.x + "," + this.y; } }; console.warn('proj4.Point will be removed in version 3, use proj4.toPoint'); } Point.fromMGRS = function(mgrsStr) { Loading lib/common/toPoint.js 0 → 100644 +13 −0 Original line number Diff line number Diff line module.exports = function (array){ var out = { x: array[0], y: array[1] }; if (array.length>2) { out.z = array[2]; } if (array.length>3) { out.m = array[3]; } return out; }; No newline at end of file lib/core.js +1 −2 Original line number Diff line number Diff line var point = require('./Point'); var proj = require('./Proj'); var transform = require('./transform'); var wgs84 = proj('WGS84'); Loading @@ -6,7 +5,7 @@ var wgs84 = proj('WGS84'); function transformer(from, to, coords) { var transformedArray; if (Array.isArray(coords)) { transformedArray = transform(from, to, point(coords)); transformedArray = transform(from, to, coords); if (coords.length === 3) { return [transformedArray.x, transformedArray.y, transformedArray.z]; } Loading lib/index.js +1 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ proj4.defaultDatum = 'WGS84'; //default datum proj4.Proj = require('./Proj'); proj4.WGS84 = new proj4.Proj('WGS84'); proj4.Point = require('./Point'); proj4.toPoint = require("./common/toPoint"); proj4.defs = require('./defs'); proj4.transform = require('./transform'); proj4.mgrs = require('mgrs'); Loading lib/transform.js +4 −1 Original line number Diff line number Diff line Loading @@ -5,9 +5,12 @@ var PJD_7PARAM = 2; var datum_transform = require('./datum_transform'); var adjust_axis = require('./adjust_axis'); var proj = require('./Proj'); var toPoint = require('./common/toPoint'); module.exports = function transform(source, dest, point) { var wgs84; if (Array.isArray(point)) { point = toPoint(point); } function checkNotWGS(source, dest) { return ((source.datum.datum_type === PJD_3PARAM || source.datum.datum_type === PJD_7PARAM) && dest.datumCode !== "WGS84"); } Loading Loading
lib/Point.js +1 −24 Original line number Diff line number Diff line Loading @@ -23,30 +23,7 @@ function Point(x, y, z) { this.y = y; this.z = z || 0.0; } this.clone = function() { return new Point(this.x, this.y, this.z); }; this.toArray = function(){ if(this.z){ return [this.x,this.y, this.z]; }else{ return [this.x,this.y]; } }; this.toString = function() { if(this.z){ return "x=" + this.x + ",y=" + this.y + ",z="+this.z; }else{ return "x=" + this.x + ",y=" + this.y; } }; this.toShortString = function() { if(this.z){ return this.x + "," + this.y+ "," + this.z; }else{ return this.x + "," + this.y; } }; console.warn('proj4.Point will be removed in version 3, use proj4.toPoint'); } Point.fromMGRS = function(mgrsStr) { Loading
lib/common/toPoint.js 0 → 100644 +13 −0 Original line number Diff line number Diff line module.exports = function (array){ var out = { x: array[0], y: array[1] }; if (array.length>2) { out.z = array[2]; } if (array.length>3) { out.m = array[3]; } return out; }; No newline at end of file
lib/core.js +1 −2 Original line number Diff line number Diff line var point = require('./Point'); var proj = require('./Proj'); var transform = require('./transform'); var wgs84 = proj('WGS84'); Loading @@ -6,7 +5,7 @@ var wgs84 = proj('WGS84'); function transformer(from, to, coords) { var transformedArray; if (Array.isArray(coords)) { transformedArray = transform(from, to, point(coords)); transformedArray = transform(from, to, coords); if (coords.length === 3) { return [transformedArray.x, transformedArray.y, transformedArray.z]; } Loading
lib/index.js +1 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ proj4.defaultDatum = 'WGS84'; //default datum proj4.Proj = require('./Proj'); proj4.WGS84 = new proj4.Proj('WGS84'); proj4.Point = require('./Point'); proj4.toPoint = require("./common/toPoint"); proj4.defs = require('./defs'); proj4.transform = require('./transform'); proj4.mgrs = require('mgrs'); Loading
lib/transform.js +4 −1 Original line number Diff line number Diff line Loading @@ -5,9 +5,12 @@ var PJD_7PARAM = 2; var datum_transform = require('./datum_transform'); var adjust_axis = require('./adjust_axis'); var proj = require('./Proj'); var toPoint = require('./common/toPoint'); module.exports = function transform(source, dest, point) { var wgs84; if (Array.isArray(point)) { point = toPoint(point); } function checkNotWGS(source, dest) { return ((source.datum.datum_type === PJD_3PARAM || source.datum.datum_type === PJD_7PARAM) && dest.datumCode !== "WGS84"); } Loading