MCPcopy Create free account
hub / github.com/OSGeo/gdal / testTransformPointsWithErrorCodes

Method testTransformPointsWithErrorCodes

swig/java/apps/OSRTransform.java:114–145  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

112 }
113
114 public static void testTransformPointsWithErrorCodes()
115 {
116 if( osr.GetPROJVersionMajor() < 8 )
117 {
118 System.out.println("Skip testTransformPointsWithErrorCodes() due to PROJ < 8");
119 return;
120 }
121 SpatialReference s = new SpatialReference("");
122 s.SetFromUserInput("+proj=longlat +ellps=GRS80");
123 SpatialReference t = new SpatialReference("");
124 t.SetFromUserInput("+proj=tmerc +ellps=GRS80");
125 CoordinateTransformation ct = CoordinateTransformation.CreateCoordinateTransformation(s, t);
126 double[][] coords = new double[][] {
127 new double[] {1, 2},
128 new double[] {1, 2, 3, 4},
129 new double[] {90, 0}
130 };
131 int[] errorCodes = ct.TransformPointsWithErrorCodes(coords);
132
133 check(Math.abs(coords[0][0] - 111257.80439304397) < 1e-5);
134 check(Math.abs(coords[0][1] - 221183.3401672801) < 1e-5);
135 check(errorCodes[0] == 0);
136
137 check(Math.abs(coords[1][0] - 111257.80439304397) < 1e-5);
138 check(Math.abs(coords[1][1] - 221183.3401672801) < 1e-5);
139 check(Math.abs(coords[1][2] - 3) < 1e-5);
140 check(Math.abs(coords[1][3] - 4) < 1e-5);
141 check(errorCodes[1] == 0);
142
143 check(coords[2][0] == Double.POSITIVE_INFINITY);
144 check(errorCodes[2] == osr.PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN);
145 }
146
147 public static void testSetDesiredAccuracy()
148 {

Callers 1

mainMethod · 0.95

Calls 3

checkMethod · 0.95
SetFromUserInputMethod · 0.80
absMethod · 0.80

Tested by

no test coverage detected