You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2022/05/17 17:12:23 UTC

[sis] 01/02: Avoid misleading error message for unsupported JPEG compression in GeoTIFF. Documentation update.

This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit 85769b95422b47d58977deeca18b9c33b94e97fa
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Tue May 17 15:28:16 2022 +0200

    Avoid misleading error message for unsupported JPEG compression in GeoTIFF.
    Documentation update.
---
 storage/sis-earth-observation/pom.xml                 |  2 +-
 .../sis/storage/geotiff/ImageFileDirectory.java       | 19 +++++++++++++++++--
 .../org/apache/sis/storage/geotiff/package-info.java  |  2 +-
 3 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/storage/sis-earth-observation/pom.xml b/storage/sis-earth-observation/pom.xml
index f224bf9a0d..a3c9b828da 100644
--- a/storage/sis-earth-observation/pom.xml
+++ b/storage/sis-earth-observation/pom.xml
@@ -39,7 +39,7 @@
   <artifactId>sis-earth-observation</artifactId>
   <name>Apache SIS Earth Observation storage</name>
   <description>
-    Landsat and MODIS metadata files to ISO 19115 metadata.
+    Read a directory of Landsat files as a single resource.
   </description>
 
 
diff --git a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/ImageFileDirectory.java b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/ImageFileDirectory.java
index f0b9a2cb78..23eee30271 100644
--- a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/ImageFileDirectory.java
+++ b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/ImageFileDirectory.java
@@ -72,7 +72,7 @@ import org.apache.sis.image.DataType;
  * @author  Johann Sorel (Geomatys)
  * @author  Thi Phuong Hao Nguyen (VNSC)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.2
+ * @version 1.3
  *
  * @see <a href="http://www.awaresystems.be/imaging/tiff/tifftags.html">TIFF Tag Reference</a>
  *
@@ -83,8 +83,9 @@ final class ImageFileDirectory extends DataCube {
     /**
      * Possible value for the {@link #tileTagFamily} field. That field tells whether image tiling
      * was specified using the {@code Tile*} family of TIFF tags or the {@code Strip*} family.
+     * JPEG was also used to have its own set of tags.
      */
-    private static final byte TILE = 1, STRIP = 2;
+    private static final byte TILE = 1, STRIP = 2, JPEG=3;
 
     /**
      * Possible value for {@link #sampleFormat} specifying how to interpret each data sample in a pixel.
@@ -609,6 +610,19 @@ final class ImageFileDirectory extends DataCube {
                 tileByteCounts = type.readVector(input(), count);
                 break;
             }
+            /*
+             * Legacy tags for JPEG formats, to be also interpreted as a tile.
+             */
+            case Tags.JPEGInterchangeFormat: {
+                setTileTagFamily(JPEG);
+                tileOffsets = type.readVector(input(), count);
+                break;
+            }
+            case Tags.JPEGInterchangeFormatLength: {
+                setTileTagFamily(JPEG);
+                tileByteCounts = type.readVector(input(), count);
+                break;
+            }
 
             ////////////////////////////////////////////////////////////////////////////////////////////////
             ////                                                                                        ////
@@ -1195,6 +1209,7 @@ final class ImageFileDirectory extends DataCube {
         if (imageHeight < 0) throw missingTag(Tags.ImageLength);
         final short offsetsTag, byteCountsTag;
         switch (tileTagFamily) {
+            case JPEG:                      // Handled as strips.
             case STRIP: {
                 if (tileWidth  < 0) tileWidth  = Math.toIntExact(imageWidth);
                 if (tileHeight < 0) tileHeight = Math.toIntExact(imageHeight);
diff --git a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/package-info.java b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/package-info.java
index 208d60ac3d..129ebd3913 100644
--- a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/package-info.java
+++ b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/package-info.java
@@ -32,7 +32,7 @@
  * @author  Thi Phuong Hao Nguyen (VNSC)
  * @author  Minh Chinh Vu (VNSC)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.2
+ * @version 1.3
  * @since   0.8
  * @module
  */