Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NFE: For input string: "-3,4028230607370965e+038" #248

Open
jandam opened this issue Nov 11, 2021 · 1 comment
Open

NFE: For input string: "-3,4028230607370965e+038" #248

jandam opened this issue Nov 11, 2021 · 1 comment

Comments

@jandam
Copy link

jandam commented Nov 11, 2021

I have GeoTIFF with malformed NO_DATA_VALUE. It was created with Slovak (same for Czech) locale - non standard decimal separator.
It would be nice to support correct parsing. Reading such GeoTIFF should not fail.

Fix: for malformed value set noData to null.

if ("nan".equalsIgnoreCase(value)) {
    noData = Double.NaN;
} else {
   try {
       noData = Double.parseDouble(value);
    } catch(NumberFormatException e) {
       try {
         noData = Double.parseDouble(value.replace(',', '.');
        } catch(NumberFormatException ignored) {
         noData = null;
        } 
     }
}


java.lang.NumberFormatException: For input string: "-3,4028230607370965e+038"
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
at java.lang.Double.parseDouble(Double.java:538)
at it.geosolutions.imageioimpl.plugins.tiff.TIFFImageReader.initializeFromMetadata(TIFFImageReader.java:1290)
at it.geosolutions.imageioimpl.plugins.tiff.TIFFImageReader.seekToImage(TIFFImageReader.java:831)
at it.geosolutions.imageioimpl.plugins.tiff.TIFFImageReader.getImageMetadata(TIFFImageReader.java:1442)
at com.crcdata.nosql.core.io.format.geotiff.GeoTiffReaderBuilder$PathReader.read(GeoTiffReaderBuilder.java:356)
at com.crcdata.nosql.core.execute.ExecBatchScan.doExecute(ExecBatchScan.java:41)
... 24 more

@jandam
Copy link
Author

jandam commented May 9, 2022

Utility 'gdalinfo' reports correct no data value
...
Band 1 Block=128x128 Type=Float32, ColorInterp=Gray
NoData Value=-3.40282306073709653e+38
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant