locationtech / geotrellis

GeoTrellis is a geographic data processing engine for high performance applications.
http://geotrellis.io
Other
1.34k stars 361 forks source link

Some errors occurred when RasterSource was reading various types of files on the Windows system #3227

Open wei-shujie opened 4 years ago

wei-shujie commented 4 years ago

My environment: Windows10, GDAL 2.4.4, released 2020/01/08 geotrellis version 3.3.0

When I used the relative path and the tif file was downloaded from the Google earth engine code:

val filePath = "gdal+file://landsat8-500-180620-180730.tif"
val rs = RasterSource(filePath)
println("RasterSource",rs)
println("Extent",rs.extent)
println("resolutions",rs.resolutions)
println("crs",rs.crs)
println("metadata",rs.metadata)

Partial throw error:

(RasterSource,GDALRasterSource(landsat8-500-180620-180730.tif,GDALWarpOptions(-of VRT -ovr AUTO)))
(Extent,Extent(53.62043930909424, 33.67334842522027, 78.35555065732527, 47.22443448616325))
(resolutions,List(CellSize(0.004491576420597608,0.004491576420597608)))
(crs,longlat-CS)
Exception in thread "main" geotrellis.raster.gdal.MalformedProjectionException: Unable to get the metadata. GDAL Error Code: 10
    at geotrellis.raster.gdal.GDALDataset$.getMetadata$extension3(GDALDataset.scala:71)
    at geotrellis.raster.gdal.GDALDataset$$anonfun$getMetadata$extension1$1.apply(GDALDataset.scala:61)
    at geotrellis.raster.gdal.GDALDataset$$anonfun$getMetadata$extension1$1.apply(GDALDataset.scala:61)
    at scala.collection.immutable.List.map(List.scala:284)
    at geotrellis.raster.gdal.GDALDataset$.getMetadata$extension1(GDALDataset.scala:61)
    at geotrellis.raster.gdal.GDALMetadata$$anonfun$apply$2.apply(GDALMetadata.scala:50)
    at geotrellis.raster.gdal.GDALMetadata$$anonfun$apply$2.apply(GDALMetadata.scala:50)
    at scala.collection.immutable.List.map(List.scala:284)
    at geotrellis.raster.gdal.GDALMetadata$.apply(GDALMetadata.scala:50)
    at geotrellis.raster.gdal.GDALRasterSource.metadata$lzycompute(GDALRasterSource.scala:59)
    at geotrellis.raster.gdal.GDALRasterSource.metadata(GDALRasterSource.scala:59)
    at geotrellis.raster.gdal.GDALRasterSource.metadata(GDALRasterSource.scala:26)
    at demo.Main$.main(Main.scala:38)
    at demo.Main.main(Main.scala)

When I used the relative path and the tif file was downloaded from the Google earth engine but use GeotiffRasterSorce code:

val filePath = "gtiff+file://landsat8-500-180620-180730.tif"
val rs = RasterSource(filePath)
println("RasterSource",rs)
println("Extent",rs.extent)
println("resolutions",rs.resolutions)
println("crs",rs.crs)
println("metadata",rs.metadata)

print:success:

(RasterSource,GeoTiffRasterSource(file://landsat8-500-180620-180730.tif))
(Extent,Extent(53.62043930909424, 33.67334842522027, 78.35555065732527, 47.22443448616325))
(resolutions,List(CellSize(0.0044915764205976086,0.004491576420597606)))
(crs,EPSG:4326)
(metadata,GeoTiffMetadata(file://landsat8-500-180620-180730.tif,EPSG:4326,11,uint8raw,GridExtent(Extent(53.62043930909424, 33.67334842522027, 78.35555065732527, 47.22443448616325),CellSize(0.0044915764205976086,0.004491576420597606),5507x3017),List(CellSize(0.0044915764205976086,0.004491576420597606)),Tags(Map(AREA_OR_POINT -> AREA),List(Map(DESCRIPTION -> B1), Map(DESCRIPTION -> B2), Map(DESCRIPTION -> B3), Map(DESCRIPTION -> B4), Map(DESCRIPTION -> B5), Map(DESCRIPTION -> B6), Map(DESCRIPTION -> B7), Map(DESCRIPTION -> B8), Map(DESCRIPTION -> B9), Map(DESCRIPTION -> B10), Map(DESCRIPTION -> B11)))))

When I used the relative path and the hdf file was downloaded from the https://ladsweb.modaps.eosdis.nasa.gov/ code:

val filePath = "gdal+file://MOD11A1.A2020098.h10v05.006.2020101072737.hdf"
val rs = RasterSource(filePath)
println("RasterSource",rs)
println("Extent",rs.extent)
println("resolutions",rs.resolutions)
println("crs",rs.crs)
println("metadata",rs.metadata)

print:error:

(RasterSource,GDALRasterSource(MOD11A1.A2020098.h10v05.006.2020101072737.hdf,GDALWarpOptions(-of VRT -ovr AUTO)))
Exception in thread "main" geotrellis.raster.gdal.MalformedDataException: Unable to construct a RasterExtent from the Transformation given. GDAL Error Code: 4
    at geotrellis.raster.gdal.GDALDataset$.rasterExtent$extension1(GDALDataset.scala:143)
    at geotrellis.raster.gdal.GDALRasterSource.gridExtent$lzycompute(GDALRasterSource.scala:93)
    at geotrellis.raster.gdal.GDALRasterSource.gridExtent(GDALRasterSource.scala:93)
    at geotrellis.raster.RasterMetadata$class.extent(RasterMetadata.scala:52)
    at geotrellis.raster.RasterSource.extent(RasterSource.scala:44)
    at demo.Main$.main(Main.scala:35)
    at demo.Main.main(Main.scala)

When I use the absolute path code:

val filePath = "gdal+file://E:\\geotrellis-sbt-template\\MOD11A1.A2020098.h10v05.006.2020101072737.hdf"
val rs = RasterSource(filePath)
println("RasterSource",rs)
println("Extent",rs.extent)
println("resolutions",rs.resolutions)
println("crs",rs.crs)
println("metadata",rs.metadata)

print:error:

(RasterSource,GDALRasterSource(gdal+file://E:\geotrellis-sbt-template\MOD11A1.A2020098.h10v05.006.2020101072737.hdf,GDALWarpOptions(-of VRT -ovr AUTO)))
Exception in thread "main" geotrellis.raster.gdal.MalformedDataException: Unable to construct a RasterExtent from the Transformation given. GDAL Error Code: 4
    at geotrellis.raster.gdal.GDALDataset$.rasterExtent$extension1(GDALDataset.scala:143)
    at geotrellis.raster.gdal.GDALRasterSource.gridExtent$lzycompute(GDALRasterSource.scala:93)
    at geotrellis.raster.gdal.GDALRasterSource.gridExtent(GDALRasterSource.scala:93)
    at geotrellis.raster.RasterMetadata$class.extent(RasterMetadata.scala:52)
    at geotrellis.raster.RasterSource.extent(RasterSource.scala:44)
    at demo.Main$.main(Main.scala:35)
    at demo.Main.main(Main.scala)
[1 of 1000] FAILURE(3) CPLE_OpenFailed(4) "Open failed." `gdal+file://E:\geotrellis-sbt-template\MOD11A1.A2020098.h10v05.006.2020101072737.hdf' does not exist in the file system, and is not recognized as a supported dataset name. 
[2 of 1000] FAILURE(3) CPLE_OpenFailed(4) "Open failed." `gdal+file://E:\geotrellis-sbt-template\MOD11A1.A2020098.h10v05.006.2020101072737.hdf' does not exist in the file system, and is not recognized as a supported dataset name. 

When I use absolute path and no prefix and the file is HDF code:

val filePath = "E:\\geotrellis-sbt-template\\MOD11A1.A2020098.h10v05.006.2020101072737.hdf"
val rs = RasterSource(filePath)
println("RasterSource",rs)
println("Extent",rs.extent)
println("resolutions",rs.resolutions)
println("crs",rs.crs)
println("metadata",rs.metadata)

print:error:

(RasterSource,GDALRasterSource(E:\geotrellis-sbt-template\MOD11A1.A2020098.h10v05.006.2020101072737.hdf,GDALWarpOptions(-of VRT -ovr AUTO)))
Exception in thread "main" geotrellis.raster.gdal.MalformedDataException: Unable to construct a RasterExtent from the Transformation given. GDAL Error Code: 4
    at geotrellis.raster.gdal.GDALDataset$.rasterExtent$extension1(GDALDataset.scala:143)
    at geotrellis.raster.gdal.GDALRasterSource.gridExtent$lzycompute(GDALRasterSource.scala:93)
    at geotrellis.raster.gdal.GDALRasterSource.gridExtent(GDALRasterSource.scala:93)
    at geotrellis.raster.RasterMetadata$class.extent(RasterMetadata.scala:52)
    at geotrellis.raster.RasterSource.extent(RasterSource.scala:44)
    at demo.Main$.main(Main.scala:35)
    at demo.Main.main(Main.scala)
zyxgis commented 4 years ago

when I use absolute path with gtiff+file://

val source = GeoTiffRasterSource("gtiff+file:///E:/bigdata/TestData/DEMN33E108.tif")

print:error:

Exception in thread "main" java.nio.file.InvalidPathException: Illegal char <:> at index 2: /E:/bigdata/TestData/DEMN33E108.tif

when I use absolute path with gtiff+

val source = GeoTiffRasterSource("gtiff+E:/bigdata/TestData/DEMN33E108.tif")

print:error:

Exception in thread "main" java.lang.RuntimeException: Unable to find RangeReaderProvider for E:/bigdata/TestData/DEMN33E108.tif

when I use absolute path with no prefix

val source = GeoTiffRasterSource("E:/bigdata/TestData/DEMN33E108.tif")

print:error:

Exception in thread "main" java.lang.RuntimeException: Unable to find RangeReaderProvider for E:/bigdata/TestData/DEMN33E108.tif