Skip to content

Commit 057bcde

Browse files
GRS80 should be recognized as a WGS84 transformation type (#127)
* Fix for transform type WGS84 derection Signed-off-by: bartels <andreas.bartels@disy.net>
1 parent f34c589 commit 057bcde

3 files changed

Lines changed: 27 additions & 4 deletions

File tree

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
*/
1616
package org.locationtech.proj4j;
1717

18+
import java.util.Objects;
19+
import java.util.stream.DoubleStream;
20+
1821
import org.locationtech.proj4j.datum.*;
22+
import org.locationtech.proj4j.util.ProjectionMath;
1923

2024
/**
2125
* Represents the operation of transforming

core/src/main/java/org/locationtech/proj4j/datum/Datum.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import java.io.IOException;
2424
import java.util.ArrayList;
2525
import java.util.List;
26-
import java.util.Objects;
2726

2827
import org.locationtech.proj4j.ProjCoordinate;
2928

@@ -150,9 +149,8 @@ public double[] getTransformToWGS84() {
150149
public int getTransformType() {
151150
if (grids != null && grids.size() > 0) return TYPE_GRIDSHIFT;
152151

153-
if (Ellipsoid.WGS84.equals(ellipsoid) || Ellipsoid.GRS80.equals(ellipsoid)) {
152+
if (Ellipsoid.WGS84.isEqual(ellipsoid) || Ellipsoid.GRS80.isEqual(ellipsoid)) {
154153
if (transform == null) return TYPE_WGS84;
155-
156154
if (isIdentity(transform)) return TYPE_WGS84;
157155
}
158156

@@ -269,4 +267,4 @@ public void inverseShift(ProjCoordinate xy) {
269267
public void setGrids(List<Grid> grids) {
270268
this.grids = grids;
271269
}
272-
}
270+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package org.locationtech.proj4j.datum;
2+
3+
import org.junit.Test;
4+
import org.locationtech.proj4j.CRSFactory;
5+
import org.locationtech.proj4j.CoordinateReferenceSystem;
6+
7+
import static org.junit.Assert.assertTrue;
8+
9+
public class TransformerTypeTest {
10+
11+
private final CRSFactory crsFactory = new CRSFactory();
12+
13+
@Test
14+
public void isTransformerTypeWgs84() {
15+
16+
String utm32znParameters = "+proj=tmerc +lat_0=0.0 +lon_0=9.0 +k_0=0.9996 +x_0=3.25E7 +y_0=0.0 +a=6378137.0 +f=298.257222101 +pm=Greenwich +units=m +no_defs";
17+
CoordinateReferenceSystem utm32znCrs = crsFactory.createFromParameters("Anon", utm32znParameters);
18+
19+
assertTrue(utm32znCrs.getDatum().getTransformType() == Datum.TYPE_WGS84);
20+
}
21+
}

0 commit comments

Comments
 (0)