Unable to open a GeoTiff DEM projected on the UTM

Hi,

I’ve projected a GeoTiFF SRTM DEM image of the Alps mountains (near Geneva - Switzerland) to the UTM projection (CH1903 / LV03) and exported it using GrassGIS, but I’m unable to open it with SNAP (while QGIS can read it).

Below is the error thrown by SNAP:

java.lang.IllegalArgumentException: intMap: keyRange > Short.MAX_VALUE
	at org.esa.snap.core.image.ImageManager.createIndexedImage(ImageManager.java:575)
	at org.esa.snap.core.image.ImageManager.createByteIndexedImage(ImageManager.java:469)
	at org.esa.snap.core.image.ImageManager.createColored1BandImage(ImageManager.java:292)
	at org.esa.snap.core.image.ImageManager.createColoredBandImage(ImageManager.java:278)
	at org.esa.snap.core.image.ColoredBandImageMultiLevelSource.createImage(ColoredBandImageMultiLevelSource.java:76)
	at com.bc.ceres.glevel.support.AbstractMultiLevelSource.getImage(AbstractMultiLevelSource.java:65)
	at com.bc.ceres.glevel.support.ConcurrentMultiLevelRenderer.renderImpl(ConcurrentMultiLevelRenderer.java:102)
	at com.bc.ceres.glevel.support.ConcurrentMultiLevelRenderer.renderImage(ConcurrentMultiLevelRenderer.java:92)
	at com.bc.ceres.glayer.support.ImageLayer.renderLayer(ImageLayer.java:207)
	at com.bc.ceres.glayer.Layer.render(Layer.java:408)
	at com.bc.ceres.glayer.Layer.renderChildren(Layer.java:441)
	at com.bc.ceres.glayer.Layer.render(Layer.java:409)
	at com.bc.ceres.glayer.swing.LayerCanvas.paintComponent(LayerCanvas.java:379)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JComponent.paintChildren(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JComponent.paintChildren(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JLayer.paint(Unknown Source)
	at javax.swing.plaf.LayerUI.paint(Unknown Source)
	at org.esa.snap.rcp.windows.ProductSceneViewTopComponent$ProductSceneViewLayerUI.paint(ProductSceneViewTopComponent.java:163)
	at javax.swing.plaf.ComponentUI.update(Unknown Source)
	at javax.swing.JComponent.paintComponent(Unknown Source)
	at javax.swing.JLayer.paint(Unknown Source)
	at javax.swing.JComponent.paintChildren(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JComponent.paintChildren(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JComponent.paintChildren(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at org.netbeans.swing.tabcontrol.TabbedContainer.paint(TabbedContainer.java:994)
	at javax.swing.JComponent.paintChildren(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JComponent.paintChildren(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JComponent.paintChildren(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JComponent.paintChildren(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JComponent.paintChildren(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JLayeredPane.paint(Unknown Source)
	at javax.swing.JComponent.paintChildren(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JComponent.paintChildren(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at org.netbeans.core.windows.view.ui.MainWindow$1.paint(MainWindow.java:189)
	at javax.swing.JComponent.paintChildren(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at javax.swing.JLayeredPane.paint(Unknown Source)
	at javax.swing.JComponent.paintChildren(Unknown Source)
	at javax.swing.JComponent.paintToOffscreen(Unknown Source)
	at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
	at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
	at javax.swing.RepaintManager.paint(Unknown Source)
	at javax.swing.JComponent.paint(Unknown Source)
	at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source)
	at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
	at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
	at java.awt.Container.paint(Unknown Source)
	at java.awt.Window.paint(Unknown Source)
	at javax.swing.RepaintManager$4.run(Unknown Source)
	at javax.swing.RepaintManager$4.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
	at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source)
	at javax.swing.RepaintManager.access$1200(Unknown Source)
	at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.awt.EventQueue.access$500(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
[catch] at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

And here is the output from gdalinfo:

$ gdalinfo shadow-utm.tif
Warning 1: Cannot find datum.csv or gdal_datum.csv
Warning 1: Cannot find ellipsoid.csv
Driver: GTiff/GeoTIFF
Files: shadow-utm.tif
       shadow-utm.tif.aux.xml
Size is 851, 1217
Coordinate System is:
PROJCS["CH1903 / LV03",
    GEOGCS["bessel",
        DATUM["unknown",
            SPHEROID["Bessel_1841",6377397.155,299.1528128,
                AUTHORITY["EPSG","0"]],
            TOWGS84[674.374,15.056,405.346,0,0,0,0],
            AUTHORITY["EPSG","6149"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433]],
    PROJECTION["Hotine_Oblique_Mercator_Azimuth_Center"],
    PARAMETER["latitude_of_center",46.95240555555556],
    PARAMETER["longitude_of_center",7.439583333333333],
    PARAMETER["azimuth",90],
    PARAMETER["rectified_grid_angle",90],
    PARAMETER["scale_factor",1],
    PARAMETER["false_easting",600000],
    PARAMETER["false_northing",200000],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]]]
Origin = (544506.559229000005871,125388.307904999994207)
Pixel Size = (25.491484743830792,-25.502833912325382)
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_SOFTWARE=GRASS GIS 7.2.1 with GDAL 2.1.3
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  544506.559,  125388.308)
Lower Left  (  544506.559,   94351.359)
Upper Right (  566199.813,  125388.308)
Lower Right (  566199.813,   94351.359)
Center      (  555353.186,  109869.833)
Band 1 Block=851x9 Type=Byte, ColorInterp=Palette
  Min=1.000 Max=1.000
  Minimum=1.000, Maximum=1.000, Mean=1.000, StdDev=0.000
  NoData Value=255
  Metadata:
    COLOR_TABLE_RULES_COUNT=1
    COLOR_TABLE_RULE_RGB_0=1.000000e+000 1.000000e+000 252 231 36 252 231 36
    STATISTICS_MAXIMUM=1
    STATISTICS_MEAN=1
    STATISTICS_MINIMUM=1
    STATISTICS_STDDEV=0

Is something wrong with this file?

Maybe we are not graceful enough.
If I do gdaliinfo on a similar product with a color table, the table is printed too.
I don’t see it in your information. In addition, minimum and maximum of your data is 1.0. All values are the same.

Driver: GTiff/GeoTIFF
Files: G:\EOData\geotiff\GlobeLand30\N35_35_2010LC030\n35_35_2010lc030.tif
       G:\EOData\geotiff\GlobeLand30\N35_35_2010LC030\n35_35_2010lc030.tfw
Size is 18295, 18676
Coordinate System is:
PROJCS["WGS 84 / TMzn35N",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",27],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["meters",1],
    AUTHORITY["EPSG","4037"]]
Origin = (225572.810000000000000,4432690.419999999900000)
Pixel Size = (30.000000000000000,-30.000000000000000)
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
  TIFFTAG_SOFTWARE=ERDAS IMAGINE
  TIFFTAG_XRESOLUTION=1
  TIFFTAG_YRESOLUTION=1
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  225572.810, 4432690.420) ( 23d47' 7.27"E, 39d59'59.41"N)
Lower Left  (  225572.810, 3872410.420) ( 23d59'40.84"E, 34d57'25.52"N)
Upper Right (  774422.810, 4432690.420) ( 30d12'52.54"E, 39d59'59.42"N)
Lower Right (  774422.810, 3872410.420) ( 30d 0'18.98"E, 34d57'25.53"N)
Center      (  499997.810, 4152550.420) ( 26d59'59.91"E, 37d31'11.68"N)
Band 1 Block=64x64 Type=Byte, ColorInterp=Palette
  Color Table (RGB with 256 entries)
    0: 0,0,0,255
    1: 0,0,0,255
    2: 0,0,0,255
    3: 0,0,0,255
    4: 0,0,0,255
    5: 0,0,0,255
    6: 0,0,0,255
    7: 0,0,0,255
    8: 0,0,0,255
    9: 0,0,0,255
   10: 250,160,255,255
   11: 200,100,200,255
   12: 250,160,255,255
   13: 250,150,200,255
   14: 200,150,210,255
   15: 250,100,255,255
   16: 250,130,255,255
   17: 200,130,230,255
   18: 220,150,255,255
...

There is a color table I just didn’t copy it.
And regarding the max and min, it’s quite normal that they are both equal to 1.0 as the file I’m working on is a shadow mask extracted from the DEM using GrassGIS (r.sunmask). So the only values present in the image are 1.0 (for the shadow) and no-data (for the rest).

Can you provide the file to me for debugging purposes?

I send you a PN for details where you can upload the data

On my windows machine, it shows one with and the other without preview image.

The tiff specification says:

And I think your map has more than 2^16 entries. That’s why the error occurs

1 Like