@Test public void testWriteNoData() throws Exception { final File input = TestData.file(GeoTiffReaderTest.class, "nodata.tiff"); final double noDataValue = -9999; GeoTiffReader reader = new GeoTiffReader(input); GridCoverage2D coverage = (GridCoverage2D) reader.read(null); Map<?, ?> props = coverage.getProperties(); assertTrue(props.containsKey(NoDataContainer.GC_NODATA)); NoDataContainer nodata = (NoDataContainer) props.get(NoDataContainer.GC_NODATA); assertEquals(noDataValue, nodata.getAsSingleValue(), 1e-6); reader.dispose(); writeAndRead(coverage, Boolean.TRUE, noDataValue); writeAndRead(coverage, Boolean.FALSE, noDataValue); System.setProperty("geotiff.writenodata", "true"); writeAndRead(coverage, null, noDataValue); System.setProperty("geotiff.writenodata", "false"); writeAndRead(coverage, null, noDataValue); System.clearProperty("geotiff.writenodata"); }
@Override public void dispose() { metadataKeyValue.clear(); super.dispose(); }
GeoTiffWriter extends AbstractGridCoverageWriter implements GridCoverageWriter { @Override public void dispose() { metadataKeyValue.clear(); super.dispose(); } }
GeoTiffWriter extends AbstractGridCoverageWriter implements GridCoverageWriter { @Override public void dispose() { metadataKeyValue.clear(); super.dispose(); } GeoTiffWriter(Object destination);  GeoTiffWriter(Object destination, Hints hints); }
GeoTiffWriter extends AbstractGridCoverageWriter implements GridCoverageWriter { @Override public void dispose() { metadataKeyValue.clear(); super.dispose(); } GeoTiffWriter(Object destination);  GeoTiffWriter(Object destination, Hints hints); @Override void setMetadataValue(String name, String value); Format getFormat(); @SuppressWarnings("rawtypes") void write(final GridCoverage gc, final GeneralParameterValue[] params); static final IIOMetadata createGeoTiffIIOMetadata(
            ImageWriter writer,
            ImageTypeSpecifier type,
            GeoTiffIIOMetadataEncoder geoTIFFMetadata,
            ImageWriteParam params); @Override void dispose(); }
GeoTiffWriter extends AbstractGridCoverageWriter implements GridCoverageWriter { @Override public void dispose() { metadataKeyValue.clear(); super.dispose(); } GeoTiffWriter(Object destination);  GeoTiffWriter(Object destination, Hints hints); @Override void setMetadataValue(String name, String value); Format getFormat(); @SuppressWarnings("rawtypes") void write(final GridCoverage gc, final GeneralParameterValue[] params); static final IIOMetadata createGeoTiffIIOMetadata(
            ImageWriter writer,
            ImageTypeSpecifier type,
            GeoTiffIIOMetadataEncoder geoTIFFMetadata,
            ImageWriteParam params); @Override void dispose();  }