Comparing version 2.9.0 to 2.9.2
{ | ||
"name": "proj4", | ||
"version": "2.9.0", | ||
"version": "2.9.2", | ||
"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.9.0", | ||
"version": "2.9.2", | ||
"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", |
@@ -86,2 +86,3 @@ import { | ||
var attemptedGrids = []; | ||
outer: | ||
for (var i = 0; i < source.grids.length; i++) { | ||
@@ -102,16 +103,19 @@ var grid = source.grids[i]; | ||
} | ||
var subgrid = grid.grid.subgrids[0]; | ||
// skip tables that don't match our point at all | ||
var epsilon = (Math.abs(subgrid.del[1]) + Math.abs(subgrid.del[0])) / 10000.0; | ||
var minX = subgrid.ll[0] - epsilon; | ||
var minY = subgrid.ll[1] - epsilon; | ||
var maxX = subgrid.ll[0] + (subgrid.lim[0] - 1) * subgrid.del[0] + epsilon; | ||
var maxY = subgrid.ll[1] + (subgrid.lim[1] - 1) * subgrid.del[1] + epsilon; | ||
if (minY > input.y || minX > input.x || maxY < input.y || maxX < input.x ) { | ||
continue; | ||
var subgrids = grid.grid.subgrids; | ||
for (var j = 0, jj = subgrids.length; j < jj; j++) { | ||
var subgrid = subgrids[j]; | ||
// skip tables that don't match our point at all | ||
var epsilon = (Math.abs(subgrid.del[1]) + Math.abs(subgrid.del[0])) / 10000.0; | ||
var minX = subgrid.ll[0] - epsilon; | ||
var minY = subgrid.ll[1] - epsilon; | ||
var maxX = subgrid.ll[0] + (subgrid.lim[0] - 1) * subgrid.del[0] + epsilon; | ||
var maxY = subgrid.ll[1] + (subgrid.lim[1] - 1) * subgrid.del[1] + epsilon; | ||
if (minY > input.y || minX > input.x || maxY < input.y || maxX < input.x ) { | ||
continue; | ||
} | ||
output = applySubgridShift(input, inverse, subgrid); | ||
if (!isNaN(output.x)) { | ||
break outer; | ||
} | ||
} | ||
output = applySubgridShift(input, inverse, subgrid); | ||
if (!isNaN(output.x)) { | ||
break; | ||
} | ||
} | ||
@@ -118,0 +122,0 @@ if (isNaN(output.x)) { |
@@ -17,5 +17,2 @@ /** | ||
var header = readHeader(view, isLittleEndian); | ||
if (header.nSubgrids > 1) { | ||
console.log('Only single NTv2 subgrids are currently supported, subsequent sub grids are ignored'); | ||
} | ||
var subgrids = readSubgrids(view, header, isLittleEndian); | ||
@@ -107,2 +104,3 @@ var nadgrid = {header: header, subgrids: subgrids}; | ||
}); | ||
gridOffset += 176 + subHeader.gridNodeCount * 16; | ||
} | ||
@@ -109,0 +107,0 @@ return grids; |
@@ -15,2 +15,9 @@ import {EPSLN, HALF_PI} from '../constants/values'; | ||
export function init() { | ||
// setting default parameters | ||
this.x0 = this.x0 || 0; | ||
this.y0 = this.y0 || 0; | ||
this.lat0 = this.lat0 || 0; | ||
this.long0 = this.long0 || 0; | ||
this.coslat0 = Math.cos(this.lat0); | ||
@@ -37,3 +44,5 @@ this.sinlat0 = Math.sin(this.lat0); | ||
this.cons = Math.sqrt(Math.pow(1 + this.e, 1 + this.e) * Math.pow(1 - this.e, 1 - this.e)); | ||
if (this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= EPSLN) { | ||
if (this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= EPSLN && Math.abs(Math.cos(this.lat_ts)) > EPSLN) { | ||
// When k0 is 1 (default value) and lat_ts is a vaild number and lat0 is at a pole and lat_ts is not at a pole | ||
// Recalculate k0 using formula 21-35 from p161 of Snyder, 1987 | ||
this.k0 = 0.5 * this.cons * msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts)) / tsfnz(this.e, this.con * this.lat_ts, this.con * Math.sin(this.lat_ts)); | ||
@@ -169,3 +178,3 @@ } | ||
export var names = ["stere", "Stereographic_South_Pole", "Polar Stereographic (variant B)"]; | ||
export var names = ["stere", "Stereographic_South_Pole", "Polar Stereographic (variant B)", "Polar_Stereographic"]; | ||
export default { | ||
@@ -172,0 +181,0 @@ init: init, |
@@ -58,3 +58,3 @@ import gauss from './gauss'; | ||
export var names = ["Stereographic_North_Pole", "Oblique_Stereographic", "Polar_Stereographic", "sterea","Oblique Stereographic Alternative","Double_Stereographic"]; | ||
export var names = ["Stereographic_North_Pole", "Oblique_Stereographic", "sterea","Oblique Stereographic Alternative","Double_Stereographic"]; | ||
export default { | ||
@@ -61,0 +61,0 @@ init: init, |
@@ -102,3 +102,3 @@ import {D2R, R2D, PJD_3PARAM, PJD_7PARAM, PJD_GRIDSHIFT} from './constants/values'; | ||
if (!hasZ) { | ||
if (point && !hasZ) { | ||
delete point.z; | ||
@@ -105,0 +105,0 @@ } |
{ | ||
"name": "proj4", | ||
"version": "2.9.0", | ||
"version": "2.9.2", | ||
"description": "Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.", | ||
@@ -44,4 +44,4 @@ "homepage": "https://proj4js.github.io/proj4js/", | ||
"mgrs": "1.0.0", | ||
"wkt-parser": "^1.3.1" | ||
"wkt-parser": "^1.3.3" | ||
} | ||
} |
@@ -192,2 +192,10 @@ // You can do this in the grunt config for each mocha task, see the `options` config | ||
}); | ||
it('should return null for transform of [0, 0] for EPSG:3413 -> EPSG:3857', function () { | ||
var point = proj4.transform( | ||
proj4.Proj('+proj=stere +lat_0=90 +lat_ts=70 +lon_0=-45 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs'), | ||
proj4.Proj('EPSG:3857'), | ||
[0, 0] | ||
); | ||
assert.strictEqual(point, null); | ||
}); | ||
it('should ignore stuff it does not know', function () { | ||
@@ -194,0 +202,0 @@ var sweref99tm = '+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs'; |
@@ -290,2 +290,11 @@ var testPoints = [ | ||
},{ | ||
code:'+proj=stere', | ||
ll:[0, -72.5], | ||
xy:[0, -9334375.897187851] | ||
},{ | ||
// Test that lat_ts at a pole is handled correctly in stere projection | ||
code:'+no_defs +units=m +ellps=GRS80 +lon_0=0 +proj=stere +lat_ts=90.0 +lat_0=90 +x_0=0 +y_0=0', | ||
ll:[69.648700, 18.955781], | ||
xy:[8527917.706, -3163255.729] | ||
},{ | ||
code:'PROJCS["WGS 84 / NSIDC Sea Ice Polar Stereographic South", GEOGCS["WGS 84", DATUM["World Geodetic System 1984", SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], UNIT["degree", 0.017453292519943295], AXIS["Geodetic longitude", EAST], AXIS["Geodetic latitude", NORTH], AUTHORITY["EPSG","4326"]], PROJECTION["Polar Stereographic (variant B)", AUTHORITY["EPSG","9829"]], PARAMETER["central_meridian", 0.0], PARAMETER["Standard_Parallel_1", -70.0], PARAMETER["false_easting", 0.0], PARAMETER["false_northing", 0.0], UNIT["m", 1.0], AXIS["Easting", "North along 90 deg East"], AXIS["Northing", "North along 0 deg"], AUTHORITY["EPSG","3976"]]', | ||
@@ -642,3 +651,3 @@ ll:[0, -72.5], | ||
}, | ||
// Omerc Type A - #273 | ||
// Omerc Type A - #273 | ||
{ | ||
@@ -671,3 +680,3 @@ code: '+proj=omerc +lat_0=4 +lonc=102.25 +alpha=323.0257964666666 +k=0.99984 +x_0=804671 +y_0=0 +no_uoff +gamma=323.1301023611111 +ellps=GRS80 +units=m +no_defs', | ||
} | ||
}, | ||
}, | ||
{ | ||
@@ -830,3 +839,25 @@ code: 'PROJCS["NAD83(NSRS2007) / Alaska zone 1", GEOGCS["NAD83(NSRS2007)", DATUM["NAD83_National_Spatial_Reference_System_2007", SPHEROID["GRS 1980",6378137,298.257222101, AUTHORITY["EPSG","7019"]], TOWGS84[0,0,0,0,0,0,0], AUTHORITY["EPSG","6759"]], PRIMEM["Greenwich",0, AUTHORITY["EPSG","8901"]], UNIT["degree",0.0174532925199433, AUTHORITY["EPSG","9122"]], AUTHORITY["EPSG","4759"]], PROJECTION["Hotine_Oblique_Mercator"], PARAMETER["latitude_of_center",57], PARAMETER["longitude_of_center",-133.6666666666667], PARAMETER["azimuth",323.1301023611111], PARAMETER["rectified_grid_angle",323.1301023611111], PARAMETER["scale_factor",0.9999], PARAMETER["false_easting",5000000], PARAMETER["false_northing",-5000000], UNIT["metre",1, AUTHORITY["EPSG","9001"]], AXIS["X",EAST], AXIS["Y",NORTH], AUTHORITY["EPSG","3468"]]', | ||
xy: [-1924281.93, 2617608.82], | ||
} | ||
}, | ||
// WKT - Arctic Polar Stereographic | ||
{ | ||
code: 'PROJCS["WGS 84 / Arctic Polar Stereographic",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Polar_Stereographic"],PARAMETER["latitude_of_origin",71],PARAMETER["central_meridian",0],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","3995"]]', | ||
ll: [0, 90], | ||
xy: [0, 0], | ||
}, | ||
{ | ||
code: 'PROJCS["WGS 84 / Arctic Polar Stereographic",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Polar_Stereographic"],PARAMETER["latitude_of_origin",71],PARAMETER["central_meridian",0],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","3995"]]', | ||
ll: [0, 0], | ||
xy: [0, -12367396.218459858], | ||
}, | ||
// WKT - Antarctic Polar Stereographic | ||
{ | ||
code: 'PROJCS["WGS 84 / Antarctic Polar Stereographic",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Polar_Stereographic"],PARAMETER["latitude_of_origin",-71],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],AUTHORITY["EPSG","3031"]]', | ||
ll: [0, -90], | ||
xy: [0, 0], | ||
}, | ||
{ | ||
code: 'PROJCS["WGS 84 / Antarctic Polar Stereographic",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Polar_Stereographic"],PARAMETER["latitude_of_origin",-71],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],AUTHORITY["EPSG","3031"]]', | ||
ll: [0, 0], | ||
xy: [0, 12367396.218459858], | ||
}, | ||
]; | ||
@@ -833,0 +864,0 @@ if (typeof module !== 'undefined') { |
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
938007
14167
Updatedwkt-parser@^1.3.3