Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/geo/projection/Projection.Baidu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 6 additions & 2 deletions src/geo/projection/Projection.EPSG3857.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
}
};

Expand Down
2 changes: 2 additions & 0 deletions src/geo/projection/Projection.EPSG4326.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
8 changes: 6 additions & 2 deletions src/geo/projection/Projection.EPSG9807.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,25 +71,29 @@ 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;
xy.y = (p.y - P.y0 + originY) / P.a;
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);
}
};

Expand Down
2 changes: 2 additions & 0 deletions src/geo/projection/Projection.IDENTITY.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down