Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
Description
GeoTools handles nodata values in a strange manner: The GridSampleDimension#getNoDataValues method treats any non-quantitative categories as nodata values when there's not a category named "No data".
This code fragment demonstrates this behavior. When "No data" category exists, getNoDataValues gives the value of that category as nodata value; once we remove that category, it gives us even more nodata values:
Category[] categories = { new Category(Category.NODATA.getName(), new Color(0, 0, 0, 0), 10), new Category("Land", new Color(87, 154, 60, 255), 1), new Category("Water", new Color(0, 0, 255, 255), 2), new Category("Cloud", new Color(255, 255, 255, 255), 3), new Category("GrayScale", (Color) null, NumberRange.create(100, 200)) }; GridSampleDimension sampleDimension = new GridSampleDimension("test", categories, null); double[] noDataValues = sampleDimension.getNoDataValues(); // noDataValues is [10]
Category[] categories = { new Category("Land", new Color(87, 154, 60, 255), 1), new Category("Water", new Color(0, 0, 255, 255), 2), new Category("Cloud", new Color(255, 255, 255, 255), 3), new Category("GrayScale", (Color) null, NumberRange.create(100, 200)) }; GridSampleDimension sampleDimension = new GridSampleDimension("test", categories, null); double[] noDataValues = sampleDimension.getNoDataValues(); // noDataValues is [1, 2, 3]
While when writing GeoTiff files, the GeoTiffWriter finds category named "No data" for nodata value. (See here and here)
The same thing happens in the ArcGrid writer. (See here).
To make the behavior of finding nodata value consistent with the file writing process and PostGIS, we'll treat values in categories named "No data" as nodata values.
Attachments
Issue Links
- links to