locationtech / locationtech/geotrellis

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

Open
#3,227 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Scala
Stars
1.4k
Forks
360
Avg merge
6h 57m
Merged PRs (30d)
12

Description

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)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the failing paths in GDALDataset.scala and GDALRasterSource.scala, then reproduce the relative and absolute Windows cases using the listed TIFF and HDF files. Establish the expected behavior for each RasterSource operation and verify that supported inputs no longer produce the reported MalformedProjectionException or MalformedDataException.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.