Skip to content

Commit ccd831d

Browse files
committed
LCC ProjectInverse readjustment, BasicCoordinateTransform.transform fix
1 parent 9016292 commit ccd831d

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

HOWTORELEASE.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ General Notes
6767

6868
Cheat sheet:
6969
- All commands are can be described via the following template:
70-
mvn -P{eclipse | central} {-Dmaven.test.skip=true | } {-pl <module> | } {install, deploy, ...}
70+
mvn -P{eclipse | central} {-Dmaven.test.skip=true | } {-pl <module> | } {install, deploy, ...} {-Dmaven.install.skip={false|true}}
7171

7272
The description of the Sonatype publish process:
7373
- Snaphots:

core/src/main/java/org/locationtech/proj4j/BasicCoordinateTransform.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ public ProjCoordinate transform(ProjCoordinate src, ProjCoordinate tgt)
156156
srcCRS.getProjection().getPrimeMeridian().toGreenwich(tgt);
157157

158158
// fixes bug where computed Z value sticks around
159-
tgt.clearZ();
159+
// commented out, see https://github.com/locationtech/proj4j/issues/116
160+
// tgt.clearZ();
160161

161162
if (doDatumTransform) {
162163
datumTransform(tgt);

core/src/main/java/org/locationtech/proj4j/proj/LambertConformalConicProjection.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,21 @@ public ProjCoordinate project(double x, double y, ProjCoordinate out) {
6868
}
6969

7070
public ProjCoordinate projectInverse(double x, double y, ProjCoordinate out) {
71+
// https://github.com/OSGeo/PROJ/blob/9.6/src/projections/lcc.cpp#L49-L53
7172
x /= scaleFactor;
7273
y /= scaleFactor;
73-
double rho = ProjectionMath.distance(x, y = rho0 - y);
74+
y = rho0 - y;
75+
double rho = ProjectionMath.distance(x, y);
7476
if (rho != 0) {
7577
if (n < 0.0) {
7678
rho = -rho;
7779
x = -x;
7880
y = -y;
7981
}
8082
if (spherical)
81-
out.y = 2.0 * Math.atan(Math.pow(c / rho, 1.0/n)) - ProjectionMath.HALFPI;
83+
out.y = 2.0 * Math.atan(Math.pow(c / rho, 1.0 / n)) - ProjectionMath.HALFPI;
8284
else
83-
out.y = ProjectionMath.phi2(Math.pow(rho / c, 1.0/n), e);
85+
out.y = ProjectionMath.phi2(Math.pow(rho / c, 1.0 / n), e);
8486
out.x = Math.atan2(x, y) / n;
8587
} else {
8688
out.x = 0.0;

core/src/test/java/org/locationtech/proj4j/CoordinateTransformTest.java

+10
Original file line numberDiff line numberDiff line change
@@ -290,4 +290,14 @@ public void testEPSG_27250() {
290290
"+proj=tmerc +lat_0=-36.87986527777778 +lon_0=174.7643393611111 +k=0.9999 +x_0=300000 +y_0=700000 +datum=nzgd49 +units=m +towgs84=59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993 +nadgrids=nzgd2kgrid0005.gsb +no_defs", 301062.2010778899, 210376.65974323952,
291291
0.001);
292292
}
293+
294+
// https://github.com/locationtech/proj4j/issues/116
295+
@Test
296+
public void testEPSG_2994() {
297+
checkTransform(
298+
"EPSG:2994", new ProjCoordinate(635788, 850485, 81),
299+
"+proj=geocent +datum=WGS84",
300+
new ProjCoordinate(-2505627.3608, -3847384.25836, 4412472.6628),
301+
0.001);
302+
}
293303
}

0 commit comments

Comments
 (0)