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

Method main

swig/java/apps/OSRTransform.java:35–68  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

33/// </summary>
34public class OSRTransform {
35 public static void main(String[] args) {
36 try
37 {
38 /* -------------------------------------------------------------------- */
39 /* Initialize srs */
40 /* -------------------------------------------------------------------- */
41 SpatialReference src = new SpatialReference("");
42 src.ImportFromProj4("+proj=latlong +datum=WGS84 +no_defs");
43 System.out.println( "SOURCE IsGeographic:" + src.IsGeographic() + " IsProjected:" + src.IsProjected() );
44 SpatialReference dst = new SpatialReference("");
45 dst.ImportFromProj4("+proj=somerc +lat_0=47.14439372222222 +lon_0=19.04857177777778 +x_0=650000 +y_0=200000 +ellps=GRS67 +units=m +no_defs");
46 System.out.println( "DEST IsGeographic:" + dst.IsGeographic() + " IsProjected:" + dst.IsProjected() );
47 /* -------------------------------------------------------------------- */
48 /* making the transform */
49 /* -------------------------------------------------------------------- */
50 CoordinateTransformation ct = CoordinateTransformation.CreateCoordinateTransformation(src, dst);
51 double[] p = new double[3];
52 p[0] = 19; p[1] = 47; p[2] = 0;
53 ct.TransformPoint(p);
54 System.out.println("x:" + p[0] + " y:" + p[1] + " z:" + p[2]);
55 ct.TransformPoint(p, 19.2, 47.5, 0);
56 System.out.println("x:" + p[0] + " y:" + p[1] + " z:" + p[2]);
57 }
58 catch (Exception e)
59 {
60 System.out.println("Error occurred: " + e.getMessage());
61 System.exit(-1);
62 }
63
64 testTransformPointWithErrorCode();
65 testTransformPointsWithErrorCodes();
66 testSetDesiredAccuracy();
67 testSetBallparkAllowed();
68 }
69
70 public static void check(boolean b)
71 {

Callers

nothing calls this directly

Calls 6

IsGeographicMethod · 0.80
IsProjectedMethod · 0.80

Tested by

no test coverage detected