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

Method main

swig/java/apps/GDALOverviews.java:48–122  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

46 }
47
48 public static void main(String[] args)
49 {
50 /* -------------------------------------------------------------------- */
51 /* Register driver(s). */
52 /* -------------------------------------------------------------------- */
53 gdal.AllRegister();
54
55 args = gdal.GeneralCmdLineProcessor(args);
56 if (args.length <= 2) usage();
57
58 try
59 {
60 /* -------------------------------------------------------------------- */
61 /* Open dataset. */
62 /* -------------------------------------------------------------------- */
63 Dataset ds = gdal.Open( args[0], gdalconst.GA_Update );
64
65 if (ds == null)
66 {
67 System.out.println("Can't open " + args[0]);
68 System.exit(-1);
69 }
70
71 System.out.println("Raster dataset parameters:");
72 System.out.println(" Projection: " + ds.GetProjectionRef());
73 System.out.println(" RasterCount: " + ds.getRasterCount());
74 System.out.println(" RasterSize (" + ds.getRasterXSize() + "," + ds.getRasterYSize() + ")");
75
76 int[] levels = new int[args.length -2];
77
78 System.out.println(levels.length);
79
80 for (int i = 2; i < args.length; i++)
81 {
82 levels[i-2] = Integer.parseInt(args[i]);
83 }
84
85 if (ds.BuildOverviews(args[1], levels, new TermProgressCallback()) != gdalconst.CE_None)
86 {
87 System.out.println("The BuildOverviews operation doesn't work");
88 System.exit(-1);
89 }
90
91 /* -------------------------------------------------------------------- */
92 /* Displaying the raster parameters */
93 /* -------------------------------------------------------------------- */
94 for (int iBand = 1; iBand <= ds.getRasterCount(); iBand++)
95 {
96 Band band = ds.GetRasterBand(iBand);
97 System.out.println("Band " + iBand + " :");
98 System.out.println(" DataType: " + band.getDataType());
99 System.out.println(" Size (" + band.getXSize() + "," + band.getYSize() + ")");
100 System.out.println(" PaletteInterp: " + gdal.GetColorInterpretationName(band.GetRasterColorInterpretation()));
101
102 for (int iOver = 0; iOver < band.GetOverviewCount(); iOver++)
103 {
104 Band over = band.GetOverview(iOver);
105 System.out.println(" OverView " + iOver + " :");

Callers

nothing calls this directly

Calls 15

usageMethod · 0.95
AllRegisterMethod · 0.80
getRasterCountMethod · 0.80
getRasterXSizeMethod · 0.80
getRasterYSizeMethod · 0.80
getDataTypeMethod · 0.80
getXSizeMethod · 0.80
getYSizeMethod · 0.80
deleteMethod · 0.80
OpenMethod · 0.45

Tested by

no test coverage detected