Comparing version 2.4.3 to 2.4.4
{ | ||
"name": "proj4", | ||
"version": "2.4.3", | ||
"version": "2.4.4", | ||
"description": "Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/proj4js/proj4js", |
{ | ||
"name": "proj4", | ||
"version": "2.4.3", | ||
"version": "2.4.4", | ||
"description": "Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.", | ||
@@ -5,0 +5,0 @@ "repo": "proj4js/proj4js", |
@@ -28,3 +28,4 @@ var json = require('rollup-plugin-json'); | ||
'aeqd', | ||
'ortho' | ||
'ortho', | ||
'qsc' | ||
]; | ||
@@ -31,0 +32,0 @@ module.exports = function(grunt) { |
@@ -51,2 +51,8 @@ var exports = {}; | ||
exports.osni52 = { | ||
towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15", | ||
ellipse: "airy", | ||
datumName: "Irish National" | ||
}; | ||
exports.ire65 = { | ||
@@ -53,0 +59,0 @@ towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15", |
@@ -13,3 +13,6 @@ export var PJD_3PARAM = 1; | ||
export var RA6 = 0.02215608465608465608; | ||
export var EPSLN = (typeof Number.EPSILON === 'undefined') ? 1.0e-10 : Number.EPSILON; | ||
export var EPSLN = 1.0e-10; | ||
// you'd think you could use Number.EPSILON above but that makes | ||
// Mollweide get into an infinate loop. | ||
export var D2R = 0.01745329251994329577; | ||
@@ -16,0 +19,0 @@ export var R2D = 57.29577951308232088; |
@@ -6,3 +6,3 @@ import proj from './Proj'; | ||
function transformer(from, to, coords) { | ||
var transformedArray; | ||
var transformedArray, out, keys; | ||
if (Array.isArray(coords)) { | ||
@@ -18,3 +18,14 @@ transformedArray = transform(from, to, coords); | ||
else { | ||
return transform(from, to, coords); | ||
out = transform(from, to, coords); | ||
keys = Object.keys(coords); | ||
if (keys.length === 2) { | ||
return out; | ||
} | ||
keys.forEach(function (key) { | ||
if (key === 'x' || key === 'y') { | ||
return; | ||
} | ||
out[key] = coords[key]; | ||
}); | ||
return out; | ||
} | ||
@@ -66,2 +77,2 @@ } | ||
} | ||
export default proj4; | ||
export default proj4; |
@@ -24,2 +24,3 @@ import tmerc from "./projections/tmerc"; | ||
import etmerc from './projections/etmerc'; | ||
import qsc from './projections/qsc'; | ||
@@ -49,3 +50,4 @@ var projs = [ | ||
aegd, | ||
etmerc | ||
etmerc, | ||
qsc | ||
]; | ||
@@ -52,0 +54,0 @@ |
@@ -19,3 +19,3 @@ import adjust_lon from '../common/adjust_lon'; | ||
-----------------------------------------------------*/ | ||
for (var i = 0; true; i++) { | ||
while (true) { | ||
var delta_theta = -(theta + Math.sin(theta) - con) / (1 + Math.cos(theta)); | ||
@@ -22,0 +22,0 @@ theta += delta_theta; |
@@ -6,2 +6,4 @@ import {D2R, R2D, PJD_3PARAM, PJD_7PARAM} from './constants/values'; | ||
import toPoint from './common/toPoint'; | ||
import checkSanity from './checkSanity'; | ||
function checkNotWGS(source, dest) { | ||
@@ -16,3 +18,3 @@ return ((source.datum.datum_type === PJD_3PARAM || source.datum.datum_type === PJD_7PARAM) && dest.datumCode !== 'WGS84') || ((dest.datum.datum_type === PJD_3PARAM || dest.datum.datum_type === PJD_7PARAM) && source.datumCode !== 'WGS84'); | ||
} | ||
checkSanity(point); | ||
// Workaround for datum shifts towgs84, if either source or destination projection is not wgs84 | ||
@@ -19,0 +21,0 @@ if (source.datum && dest.datum && checkNotWGS(source, dest)) { |
{ | ||
"name": "proj4", | ||
"version": "2.4.3", | ||
"version": "2.4.4", | ||
"description": "Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.", | ||
@@ -23,16 +23,16 @@ "main": "dist/proj4-src.js", | ||
"devDependencies": { | ||
"chai": "~1.8.1", | ||
"curl": "git://github.com/cujojs/curl.git", | ||
"grunt": "^1.0.1", | ||
"grunt-cli": "~0.1.13", | ||
"grunt": "~0.4.2", | ||
"grunt-contrib-connect": "~0.6.0", | ||
"grunt-contrib-jshint": "~1.1.0", | ||
"chai": "~1.8.1", | ||
"grunt-contrib-uglify": "~0.11.1", | ||
"grunt-mocha-phantomjs": "~0.4.0", | ||
"grunt-rollup": "^1.0.1", | ||
"istanbul": "~0.2.4", | ||
"mocha": "~1.17.1", | ||
"grunt-mocha-phantomjs": "~0.4.0", | ||
"rollup": "^0.41.4", | ||
"rollup-plugin-json": "^2.0.1", | ||
"rollup-plugin-node-resolve": "^2.0.0", | ||
"grunt-rollup": "^1.0.1", | ||
"grunt-contrib-uglify": "~0.11.1", | ||
"curl": "git://github.com/cujojs/curl.git", | ||
"istanbul": "~0.2.4", | ||
"tin": "~0.4.0" | ||
@@ -42,4 +42,4 @@ }, | ||
"mgrs": "1.0.0", | ||
"wkt-parser": "^1.1.3" | ||
"wkt-parser": "^1.2.0" | ||
} | ||
} |
@@ -25,2 +25,3 @@ import tmerc from './lib/projections/tmerc'; | ||
import ortho from './lib/projections/ortho'; | ||
import qsc from './lib/projections/qsc'; | ||
export default function(proj4){ | ||
@@ -51,2 +52,3 @@ proj4.Proj.projections.add(tmerc); | ||
proj4.Proj.projections.add(ortho); | ||
proj4.Proj.projections.add(qsc); | ||
} |
@@ -169,2 +169,23 @@ // You can do this in the grunt config for each mocha task, see the `options` config | ||
}); | ||
describe('points', function () { | ||
it('should ignore stuff it does not know', function (){ | ||
var sweref99tm = '+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs'; | ||
var rt90 = '+lon_0=15.808277777799999 +lat_0=0.0 +k=1.0 +x_0=1500000.0 +y_0=0.0 +proj=tmerc +ellps=bessel +units=m +towgs84=414.1,41.3,603.1,-0.855,2.141,-7.023,0 +no_defs'; | ||
var rslt = proj4(sweref99tm, rt90).forward({ | ||
x: 319180, | ||
y: 6399862, | ||
z: 0, | ||
m: 1000, | ||
method: function () { | ||
return 'correct answer'; | ||
} | ||
}); | ||
assert.closeTo(rslt.x, 1271137.9275601401, 0.000001); | ||
assert.closeTo(rslt.y, 6404230.291459564, 0.000001); | ||
assert.equal(rslt.z, 0); | ||
assert.equal(rslt.m, 1000); | ||
assert.equal(rslt.method(), 'correct answer'); | ||
}); | ||
}); | ||
describe('defs', function() { | ||
@@ -208,2 +229,22 @@ assert.equal(proj4.defs('testmerc'), proj4.defs['testmerc']); | ||
}); | ||
it('should throw when passed null', function() { | ||
assert.throws(function() { | ||
proj4('+proj=utm +zone=31', [null, 0]); | ||
}, 'coordinates must be finite numbers', 'should work'); | ||
}); | ||
it('should throw when passed NaN', function() { | ||
assert.throws(function() { | ||
proj4('+proj=utm +zone=31', [0, NaN]); | ||
}, 'coordinates must be finite numbers', 'should work'); | ||
}); | ||
it('should throw when passed Infinity', function() { | ||
assert.throws(function() { | ||
proj4('+proj=utm +zone=31', [Infinity, 0]); | ||
}, 'coordinates must be finite numbers', 'should work'); | ||
}); | ||
it('should throw when passed -Infinity', function() { | ||
assert.throws(function() { | ||
proj4('+proj=utm +zone=31', [-Infinity, 0]); | ||
}, 'coordinates must be finite numbers', 'should work'); | ||
}); | ||
}); | ||
@@ -270,2 +311,3 @@ describe('utility', function() { | ||
}); | ||
}); | ||
@@ -272,0 +314,0 @@ } |
@@ -302,2 +302,99 @@ var testPoints = [ | ||
}, | ||
// QSC WGS84 | ||
{ | ||
code: '+proj=qsc +lat_0=0 +lon_0=0 +units=m +datum=WGS84', | ||
ll: [2, 1], | ||
xy: [304638.4508447283296846, 164123.8709293559950311] | ||
}, | ||
{ | ||
code: '+proj=qsc +lat_0=0 +lon_0=90 +units=m +datum=WGS84', | ||
ll: [2, 1], | ||
xy: [-11576764.4717786349356174, 224687.8649776891397778] | ||
}, | ||
{ | ||
code: '+proj=qsc +lat_0=0 +lon_0=180 +units=m +datum=WGS84', | ||
ll: [2, 1], | ||
xy: [-15631296.4526007361710072, 8421356.1168374437838793] | ||
}, | ||
{ | ||
code: '+proj=qsc +lat_0=0 +lon_0=-90 +units=m +datum=WGS84', | ||
ll: [2, 1], | ||
xy: [11988027.5987015366554260, 232669.8736086514254566 | ||
] | ||
}, | ||
{ | ||
code: '+proj=qsc +lat_0=90 +lon_0=0 +units=m +datum=WGS84', | ||
ll: [2, 1], | ||
xy: [456180.4073964518611319, -11678366.5914389267563820 | ||
] | ||
}, | ||
{ | ||
code: '+proj=qsc +lat_0=-90 +lon_0=0 +units=m +datum=WGS84', | ||
ll: [2, 1], | ||
xy: [464158.3228444084525108, 11882603.8180405404418707] | ||
}, | ||
// QSC WGS84 WKT | ||
{ | ||
code: 'PROJCS["unnamed",GEOGCS["WGS 84",DATUM["unknown",SPHEROID["WGS84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]],PROJECTION["Quadrilateralized_Spherical_Cube"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",0],UNIT["Meter",1]]', | ||
ll: [2, 1], | ||
xy: [304638.4508447283296846, 164123.8709293559950311] | ||
}, | ||
{ | ||
code: 'PROJCS["unnamed",GEOGCS["WGS 84",DATUM["unknown",SPHEROID["WGS84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]],PROJECTION["Quadrilateralized_Spherical_Cube"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",90],UNIT["Meter",1]]', | ||
ll: [2, 1], | ||
xy: [-11576764.4717786349356174, 224687.8649776891397778] | ||
}, | ||
{ | ||
code: 'PROJCS["unnamed",GEOGCS["WGS 84",DATUM["unknown",SPHEROID["WGS84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]],PROJECTION["Quadrilateralized_Spherical_Cube"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",180],UNIT["Meter",1]]', | ||
ll: [2, 1], | ||
xy: [-15631296.4526007361710072, 8421356.1168374437838793] | ||
}, | ||
{ | ||
code: 'PROJCS["unnamed",GEOGCS["WGS 84",DATUM["unknown",SPHEROID["WGS84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]],PROJECTION["Quadrilateralized_Spherical_Cube"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-90],UNIT["Meter",1]]', | ||
ll: [2, 1], | ||
xy: [11988027.5987015366554260, 232669.8736086514254566 | ||
] | ||
}, | ||
{ | ||
code: 'PROJCS["unnamed",GEOGCS["WGS 84",DATUM["unknown",SPHEROID["WGS84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]],PROJECTION["Quadrilateralized_Spherical_Cube"],PARAMETER["latitude_of_origin",90],PARAMETER["central_meridian",0],UNIT["Meter",1]]', | ||
ll: [2, 1], | ||
xy: [456180.4073964518611319, -11678366.5914389267563820 | ||
] | ||
}, | ||
{ | ||
code: 'PROJCS["unnamed",GEOGCS["WGS 84",DATUM["unknown",SPHEROID["WGS84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]],PROJECTION["Quadrilateralized_Spherical_Cube"],PARAMETER["latitude_of_origin",-90],PARAMETER["central_meridian",0],UNIT["Meter",1]]', | ||
ll: [2, 1], | ||
xy: [464158.3228444084525108, 11882603.8180405404418707] | ||
}, | ||
// QSC Mars | ||
{ | ||
code: '+proj=qsc +units=m +a=3396190 +b=3376200 +lat_0=0 +lon_0=0', | ||
ll: [2, 1], | ||
xy: [162139.9347801624389831, 86935.6184961361577734] | ||
}, | ||
{ | ||
code: '+proj=qsc +units=m +a=3396190 +b=3376200 +lat_0=0 +lon_0=90', | ||
ll: [2, 1], | ||
xy: [-6164327.7345527401193976,119033.1141843862715177] | ||
}, | ||
{ | ||
code: '+proj=qsc +units=m +a=3396190 +b=3376200 +lat_0=0 +lon_0=180', | ||
ll: [2, 1], | ||
xy: [-8327904.7183852149173617, 4465226.5862284321337938] | ||
}, | ||
{ | ||
code: '+proj=qsc +units=m +a=3396190 +b=3376200 +lat_0=0 +lon_0=-90', | ||
ll: [2, 1], | ||
xy: [6383315.0547841880470514, 123261.7574065744993277] | ||
}, | ||
{ | ||
code: '+proj=qsc +units=m +a=3396190 +b=3376200 +lat_0=90 +lon_0=0', | ||
ll: [2, 1], | ||
xy: [242914.9289354820502922, -6218701.0766915259882808] | ||
}, | ||
{ | ||
code: '+proj=qsc +units=m +a=3396190 +b=3376200 +lat_0=-90 +lon_0=0', | ||
ll: [2, 1], | ||
xy: [247141.3965058987669181, 6326900.0192015860229731] | ||
}, | ||
// check that coordinates at 180 and -180 deg. longitude don't wrap around | ||
@@ -412,2 +509,12 @@ { | ||
xy: [-959006.4926646841, 113457.31956265299] | ||
}, | ||
{ | ||
code: '+proj=moll +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs', | ||
ll: [-180, 80.11], | ||
xy: [-5837753.259051185, 8534718.648155002] | ||
}, | ||
{ | ||
code: '+proj=moll +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m', | ||
ll: [-180, 80], | ||
xy: [-5879879.246669655, 8527486.041776998] | ||
} | ||
@@ -414,0 +521,0 @@ ]; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
478096
119
12110
Updatedwkt-parser@^1.2.0