diff --git a/src/geo/projection/Projection.Baidu.ts b/src/geo/projection/Projection.Baidu.ts index 3ef0fa43d7..1d7fa42951 100644 --- a/src/geo/projection/Projection.Baidu.ts +++ b/src/geo/projection/Projection.Baidu.ts @@ -69,12 +69,14 @@ const ProjectionMethods = { cD[8] * cB * cB * cB * cB * cB * cB; T *= (cC.x < 0 ? -1 : 1); cE *= (cC.y < 0 ? -1 : 1); + const z = cC.z; if (out) { out.x = T; out.y = cE; + out.z = z; return out; } - return new Coordinate(T, cE); + return new Coordinate(T, cE, z); }, toRadians: function (T: number): number { return Math.PI * T / 180; diff --git a/src/geo/projection/Projection.EPSG3857.ts b/src/geo/projection/Projection.EPSG3857.ts index 59c199f92e..d7b8edbaf7 100644 --- a/src/geo/projection/Projection.EPSG3857.ts +++ b/src/geo/projection/Projection.EPSG3857.ts @@ -30,12 +30,14 @@ const EPSG3857Projection = { } const x = lng * metersPerDegree; const y = c * metersPerDegree; + const z = lnglat.z; if (out) { out.x = x; out.y = y; + out.z = z; return out; } - return new Coordinate(x, y); + return new Coordinate(x, y, z); }, unproject: function (pLnglat: Coordinate, out?: Coordinate) { @@ -60,12 +62,14 @@ const EPSG3857Projection = { // const ry = wrap(c, -this.maxLatitude, this.maxLatitude); const rx = x; const ry = c; + const rz = pLnglat.z; if (out) { out.x = rx; out.y = ry; + out.z = rz; return out; } - return new Coordinate(rx, ry); + return new Coordinate(rx, ry, rz); } }; diff --git a/src/geo/projection/Projection.EPSG4326.ts b/src/geo/projection/Projection.EPSG4326.ts index c627a77b2f..a366e991d6 100644 --- a/src/geo/projection/Projection.EPSG4326.ts +++ b/src/geo/projection/Projection.EPSG4326.ts @@ -14,6 +14,7 @@ const EPSG4326Projection = { if (out) { out.x = p.x; out.y = p.y; + out.z = p.z; return out; } return new Coordinate(p); @@ -22,6 +23,7 @@ const EPSG4326Projection = { if (out) { out.x = p.x; out.y = p.y; + out.z = p.z; return out; } return new Coordinate(p); diff --git a/src/geo/projection/Projection.EPSG9807.ts b/src/geo/projection/Projection.EPSG9807.ts index a56716017a..9fbeb4eba9 100644 --- a/src/geo/projection/Projection.EPSG9807.ts +++ b/src/geo/projection/Projection.EPSG9807.ts @@ -71,12 +71,14 @@ const EPSG9807Projection = { P.fwd(lp, xy); const x = P.a * xy.x + P.x0 - originX; const y = P.a * xy.y + P.y0 - originY; + const z = p.z; if (out) { out.x = x; out.y = y; + out.z = z; return out; } - return new Coordinate(x, y); + return new Coordinate(x, y, z); }, unproject: function (p: Coordinate, out?: Coordinate): Coordinate { xy.x = (p.x - P.x0 + originX) / P.a; @@ -84,12 +86,14 @@ const EPSG9807Projection = { P.inv(xy, lp); const x = (lp.lam + P.lam0) * RAD_TO_DEG; const y = lp.phi * RAD_TO_DEG; + const z = p.z; if (out) { out.x = x; out.y = y; + out.z = z; return out; } - return new Coordinate(x, y); + return new Coordinate(x, y, z); } }; diff --git a/src/geo/projection/Projection.IDENTITY.ts b/src/geo/projection/Projection.IDENTITY.ts index 8621c3f819..d1f2d2dd03 100644 --- a/src/geo/projection/Projection.IDENTITY.ts +++ b/src/geo/projection/Projection.IDENTITY.ts @@ -13,6 +13,7 @@ const IdentityProjection = { if (out) { out.x = p.x; out.y = p.y; + out.z = p.z; return out; } return p.copy(); @@ -21,6 +22,7 @@ const IdentityProjection = { if (out) { out.x = p.x; out.y = p.y; + out.z = p.z; return out; } return p.copy();