build: Update proj4 library.
This is part of
MODIFY
package-lock.json
package-lock.json
"optional": true,
"requires": {
"lie": "~3.3.0",
+ "pako": "~1.0.2",
"readable-stream": "~2.3.6",
"set-immediate-shim": "~1.0.1"
+ },
+ "dependencies": {
+ "pako": {
+ "version": "1.0.11",
+ "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",
+ "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==",
+ "optional": true
+ }
}
},
"karma": {
"dev": true
},
"proj4": {
- "version": "2.6.0",
- "resolved": "https://registry.npmjs.org/proj4/-/proj4-2.6.0.tgz",
- "integrity": "sha512-ll2WyehUFOyzEZtN8hAiOTmZpuDCN5V+4A/HjhPbhlwVwlsFKnIHSZ3l3uhzgDndHjoL2MyERFGe9VmXN4rYUg==",
+ "version": "2.7.5",
+ "resolved": "https://registry.npmjs.org/proj4/-/proj4-2.7.5.tgz",
+ "integrity": "sha512-5ecXUXbHAfvdhfBQpU7EhUfPCQGUCPmVup/4gnZA3bJY3JcK/xxzm4QQDz1xiXokN6ux65VDczlCtBtKrTSpAQ==",
"requires": {
"mgrs": "1.0.0",
- "wkt-parser": "^1.2.0"
+ "wkt-parser": "^1.3.1"
}
},
"promise": {
"commander": "5.1.0",
"gl-matrix": "3.3.0",
"jszip": "3.4.0",
+ "pako": "1.0.11",
"seedrandom": "3.0.5",
"shelljs": "0.8.4",
"webvr-polyfill": "0.10.11",
"webworker-promise": "0.4.2",
"xmlbuilder": "15.1.1"
+ },
+ "dependencies": {
+ "pako": {
+ "version": "1.0.11",
+ "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",
+ "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==",
+ "optional": true
+ }
}
},
"watchpack": {
}
},
"wkt-parser": {
- "version": "1.2.4",
- "resolved": "https://registry.npmjs.org/wkt-parser/-/wkt-parser-1.2.4.tgz",
- "integrity": "sha512-ZzKnc7ml/91fOPh5bANBL4vUlWPIYYv11waCtWTkl2TRN+LEmBg60Q1MA8gqV4hEp4MGfSj9JiHz91zw/gTDXg=="
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/wkt-parser/-/wkt-parser-1.3.1.tgz",
+ "integrity": "sha512-XK5qV+Y5gsygQfHx2/cS5a7Zxsgleaw8iX5UPC5eOXPc0TgJAu1JB9lr0iYYX3zAnN3p0aNiaN5c+1Bdblxwrg=="
},
"word-wrap": {
"version": "1.2.3",

MODIFY
package.json
package.json
"jquery": "^3.6.0",
"kdbush": "^3.0.0",
"mousetrap": "^1.6.5",
- "proj4": "2.6.0",
+ "proj4": "^2.7.5",
"vgl": "0.3.11"
},
"optionalDependencies": {

MODIFY
src/trackFeature.js
src/trackFeature.js
@@ -228,21 +228,21 @@ var trackFeature = function (arg) {
if (d.posidx1 === undefined) {
pos = m_tracks.positionFunc(tracks[i][d.posidx], d.posidx, tracks[i], i);
} else {
- pos0 = trans.forward(m_tracks.positionFunc(tracks[i][d.posidx0], d.posidx0, tracks[i], i));
- pos1 = trans.forward(m_tracks.positionFunc(tracks[i][d.posidx1], d.posidx1, tracks[i], i));
+ pos0 = trans.forward(m_tracks.positionFunc(tracks[i][d.posidx0], d.posidx0, tracks[i], i), true);
+ pos1 = trans.forward(m_tracks.positionFunc(tracks[i][d.posidx1], d.posidx1, tracks[i], i), true);
pos = trans.inverse({
x: pos0.x * d.factor0 + pos1.x * d.factor1,
y: pos0.y * d.factor0 + pos1.y * d.factor1,
z: (pos0.z || 0) * d.factor0 + (pos1.z || 0) * d.factor1
- });
+ }, true);
}
d.x = pos.x;
d.y = pos.y;
d.z = pos.z || 0;
if (calcAngle) {
if (d.posidx1 === undefined) {
- pos0 = trans.forward(d.angidx0 === d.posidx ? pos : m_tracks.positionFunc(tracks[i][d.angidx0], d.angidx0, tracks[i], i));
- pos1 = trans.forward(d.angidx1 === d.posidx ? pos : m_tracks.positionFunc(tracks[i][d.angidx1], d.angidx1, tracks[i], i));
+ pos0 = trans.forward(d.angidx0 === d.posidx ? pos : m_tracks.positionFunc(tracks[i][d.angidx0], d.angidx0, tracks[i], i), true);
+ pos1 = trans.forward(d.angidx1 === d.posidx ? pos : m_tracks.positionFunc(tracks[i][d.angidx1], d.angidx1, tracks[i], i), true);
}
d.angle = Math.atan2(pos1.y - pos0.y, pos1.x - pos0.x);
}

MODIFY
src/transform.js
src/transform.js
@@ -193,7 +193,7 @@ var transform = function (options) {
var mp = vec3.transformMat4(util.vec3AsArray(), [point.x, point.y, point.z || 0], m_source_matrix_inv);
point = {x: mp[0], y: mp[1], z: mp[2]};
}
- var pt = m_proj.forward(point);
+ var pt = m_proj.forward(point, true);
pt.z = point.z || 0;
if (m_target_matrix) {
var ip = vec3.transformMat4(util.vec3AsArray(), [pt.x, pt.y, pt.z], m_target_matrix);
@@ -214,7 +214,7 @@ var transform = function (options) {
var mp = vec3.transformMat4(util.vec3AsArray(), [point.x, point.y, point.z || 0], m_target_matrix_inv);
point = {x: mp[0], y: mp[1], z: mp[2]};
}
- var pt = m_proj.inverse(point);
+ var pt = m_proj.inverse(point, true);
pt.z = point.z || 0;
if (m_source_matrix) {
var ip = vec3.transformMat4(util.vec3AsArray(), [pt.x, pt.y, pt.z], m_source_matrix);
@@ -359,7 +359,7 @@ transform.transformCoordinates = function (srcPrj, tgtPrj, coordinates, numberOf
}
var trans = transform({source: srcPrj, target: tgtPrj}), output;
if (util.isObject(coordinates) && 'x' in coordinates && 'y' in coordinates) {
- output = trans.forward({x: +coordinates.x, y: +coordinates.y, z: +coordinates.z || 0});
+ output = trans.forward({x: +coordinates.x, y: +coordinates.y, z: +coordinates.z || 0}, true);
if ('z' in coordinates) {
return output;
}
@@ -368,7 +368,7 @@ transform.transformCoordinates = function (srcPrj, tgtPrj, coordinates, numberOf
if (Array.isArray(coordinates) && coordinates.length === 1 &&
util.isObject(coordinates[0]) && 'x' in coordinates[0] &&
'y' in coordinates[0]) {
- output = trans.forward({x: +coordinates[0].x, y: +coordinates[0].y, z: +coordinates[0].z || 0});
+ output = trans.forward({x: +coordinates[0].x, y: +coordinates[0].y, z: +coordinates[0].z || 0}, true);
if ('z' in coordinates[0]) {
return [output];
}
@@ -549,7 +549,7 @@ transform.transformCoordinatesArray = function (trans, coordinates, numberOfComp
initPoint.x = xAcc(i);
initPoint.y = yAcc(i);
initPoint.z = zAcc(i);
- projPoint = trans.forward(initPoint);
+ projPoint = trans.forward(initPoint, true);
writer(i, projPoint.x, projPoint.y, projPoint.z);
}
return output;
@@ -582,11 +582,12 @@ transform.transformCoordinatesFlatArray3 = function (srcPrj, tgtPrj, coordinates
var src = proj4.Proj(srcPrj),
tgt = proj4.Proj(tgtPrj),
projPoint, initPoint = {};
+ let trans = new proj4(src, tgt);
for (i = coordinates.length - 3; i >= 0; i -= 3) {
initPoint.x = +coordinates[i];
initPoint.y = +coordinates[i + 1];
initPoint.z = +(coordinates[i + 2] || 0.0);
- projPoint = proj4.transform(src, tgt, initPoint);
+ projPoint = trans.forward(initPoint, true);
coordinates[i] = projPoint.x;
coordinates[i + 1] = projPoint.y;
coordinates[i + 2] = projPoint.z === undefined ? initPoint.z : projPoint.z;

MODIFY
tests/cases/transform.js
tests/cases/transform.js
@@ -37,24 +37,24 @@ describe('geo.transform', function () {
function test_point(pt) {
var pt1 = $.extend({}, pt[0]), pt2 = $.extend({}, pt[1]);
it(str(pt[0]) + ' -> ' + str(pt[1]), function () {
- expect(r2(proj.forward(pt1), pt[1])).toBeLessThan(tgt_unit);
+ expect(r2(proj.forward(pt1), pt[1], true)).toBeLessThan(tgt_unit);
});
it(str(pt[0]) + ' <- ' + str(pt[1]), function () {
- expect(r2(pt[0], proj.inverse(pt2))).toBeLessThan(src_unit);
+ expect(r2(pt[0], proj.inverse(pt2, true))).toBeLessThan(src_unit);
});
}
pts.forEach(test_point);
it('Array of points ( forward )', function () {
var a = pts.map(function (d) { return $.extend({}, d[0]); }),
- c = proj.forward(a);
+ c = proj.forward(a, true);
pts.forEach(function (d, i) {
expect(r2(d[1], c[i])).toBeLessThan(tgt_unit);
});
});
it('Array of points ( inverse )', function () {
var a = pts.map(function (d) { return $.extend({}, d[1]); }),
- c = proj.inverse(a);
+ c = proj.inverse(a, true);
pts.forEach(function (d, i) {
expect(r2(d[0], c[i])).toBeLessThan(src_unit);
});
@@ -116,7 +116,7 @@ describe('geo.transform', function () {
expect(geo.transform.defs.hasOwnProperty('my projection')).toBe(true);
var p = geo.transform({source: 'EPSG:4326', target: 'my projection'});
- expect(p.forward({x: 10, y: -10, z: 0})).toEqual({x: 10, y: -10, z: 0});
+ expect(p.forward({x: 10, y: -10, z: 0}, true)).toEqual({x: 10, y: -10, z: 0});
});
it('lookup', function (done) {
@@ -439,13 +439,13 @@ describe('geo.transform', function () {
});
it('transform object forward', function () {
var proj = geo.transform({source: source, target: target});
- expect(closeToEqual(proj.forward({x: 1, y: 2}), {x: -1052.974, y: -1158.014, z: 0})).toBe(true);
- expect(closeToEqual(proj.inverse({x: -1052.974, y: -1158.014}), {x: 1, y: 2, z: 0})).toBe(true);
+ expect(closeToEqual(proj.forward({x: 1, y: 2}, true), {x: -1052.974, y: -1158.014, z: 0})).toBe(true);
+ expect(closeToEqual(proj.inverse({x: -1052.974, y: -1158.014}, true), {x: 1, y: 2, z: 0})).toBe(true);
});
it('transform object inverse', function () {
var proj = geo.transform({source: target, target: source});
- expect(closeToEqual(proj.inverse({x: 1, y: 2}), {x: -1052.974, y: -1158.014, z: 0})).toBe(true);
- expect(closeToEqual(proj.forward({x: -1052.974, y: -1158.014}), {x: 1, y: 2, z: 0})).toBe(true);
+ expect(closeToEqual(proj.inverse({x: 1, y: 2}, true), {x: -1052.974, y: -1158.014, z: 0})).toBe(true);
+ expect(closeToEqual(proj.forward({x: -1052.974, y: -1158.014}, true), {x: 1, y: 2, z: 0})).toBe(true);
});
});
});

build: Update proj4 library.

This is part of #1132.