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

Method testTransformPointWithErrorCode

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

Source from the content-addressed store, hash-verified

82 }
83
84 public static void testTransformPointWithErrorCode()
85 {
86 if( osr.GetPROJVersionMajor() < 8 )
87 {
88 System.out.println("Skip testTransformPointWithErrorCode() due to PROJ < 8");
89 return;
90 }
91 SpatialReference s = new SpatialReference("");
92 s.SetFromUserInput("+proj=longlat +ellps=GRS80");
93 SpatialReference t = new SpatialReference("");
94 t.SetFromUserInput("+proj=tmerc +ellps=GRS80");
95 CoordinateTransformation ct = CoordinateTransformation.CreateCoordinateTransformation(s, t);
96
97 {
98 double[] out = new double[4];
99 int errorCode = ct.TransformPointWithErrorCode(out, 1, 2, 0, 0);
100 check(Math.abs(out[0] - 111257.80439304397) < 1e-5);
101 check(Math.abs(out[1] - 221183.3401672801) < 1e-5);
102 check(errorCode == 0);
103 }
104
105 {
106 double[] out = new double[4];
107 int errorCode = ct.TransformPointWithErrorCode(out, 90, 0, 0, 0);
108 check(out[0] == Double.POSITIVE_INFINITY);
109 check(errorCode == osr.PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN);
110 }
111
112 }
113
114 public static void testTransformPointsWithErrorCodes()
115 {

Callers 1

mainMethod · 0.95

Calls 3

checkMethod · 0.95
SetFromUserInputMethod · 0.80
absMethod · 0.80

Tested by

no test coverage detected