Uploaded image for project: 'Apache Sedona'
  1. Apache Sedona
  2. SEDONA-360

Handle nodata values of raster bands in a more concise way

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.5.0

    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

          Activity

            People

              Unassigned Unassigned
              kontinuation Kristin Cowalcijk
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m