void testReadData() throws IOException { IFDEntry tileOffsetTag = findTag(Tag.TileOffsets); if (tileOffsetTag != null) { int tileOffset = tileOffsetTag.value[0]; IFDEntry tileSizeTag = findTag(Tag.TileByteCounts); int tileSize = tileSizeTag.value[0]; System.out.println("tileOffset =" + tileOffset + " tileSize=" + tileSize); testReadData(tileOffset, tileSize); } else { IFDEntry stripOffsetTag = findTag(Tag.StripOffsets); if (stripOffsetTag != null) { int stripOffset = stripOffsetTag.value[0]; IFDEntry stripSizeTag = findTag(Tag.StripByteCounts); int stripSize = stripSizeTag.value[0]; System.out.println("stripOffset =" + stripOffset + " stripSize=" + stripSize); testReadData(stripOffset, stripSize); } } }
private void parseGeoInfo() { IFDEntry keyDir = findTag(Tag.GeoKeyDirectoryTag); IFDEntry dparms = findTag(Tag.GeoDoubleParamsTag); IFDEntry aparams = findTag(Tag.GeoAsciiParamsTag); IFDEntry data = findTag(Tag.get(location)); if (data == null) { System.out.println("********ERROR parseGeoInfo: cant find Tag code = " + location);
@Test public void testRead() throws IOException { try (GeoTiff geotiff = new GeoTiff(filename)) { geotiff.read(); StringWriter sw = new StringWriter(); geotiff.showInfo(new PrintWriter(sw)); logger.debug(sw.toString()); IFDEntry tileOffsetTag = geotiff.findTag(Tag.TileOffsets); if (tileOffsetTag != null) { int tileOffset = tileOffsetTag.value[0]; IFDEntry tileSizeTag = geotiff.findTag(Tag.TileByteCounts); int tileSize = tileSizeTag.value[0]; logger.debug("tileOffset={} tileSize={}", tileOffset, tileSize); } else { IFDEntry stripOffsetTag = geotiff.findTag(Tag.StripOffsets); if (stripOffsetTag != null) { int stripOffset = stripOffsetTag.value[0]; IFDEntry stripSizeTag = geotiff.findTag(Tag.StripByteCounts); if (stripSizeTag == null) throw new IllegalStateException(); int stripSize = stripSizeTag.value[0]; logger.debug("stripOffset={} stripSize={}", stripOffset, stripSize); } } } }