Object Storage Service (OSS) is a secure, cost-effective, and high-durability cloud storage service provided by Alibaba Cloud. It can store large volumes of data in the cloud. This topic describes how to use DLA Ganos to load Tag Image File Format (TIFF) files stored in OSS as DataFrames.

Procedure

  1. Initialize a Spark session.
     val spark: SparkSession = {
        val session = SparkSession.builder
          .master("local[*]")
          .withKryoSerialization
          .config(additionalConf)
          .getOrCreate()
        session
      }
    
     // Load the Raster driver for DLA Ganos.
     spark.withGanosRaster
  2. Define OSS connection parameters and load layers.
      val options = Map(
        "crs"->"EPSG:4326",
        "endpoint" -> "Endpoint of OSS",
        "accessKeyId" ->"AccessKey Id",
        "accessKeySecret" -> "AccessKey Secret")
    
    val uri=new java.net.URI("oss://<Name of the OSS bucket>/srtm_60_05.tif") // Specifies the name of the TIFF file in OSS.
    
    val layer=spark.read.ganos.oss(options).loadLayer(uri)
  3. View the results.
    To load multiple OSS data records at the same time, change the URI to the name of the OSS directory:
    val uri=new java.net.URI("oss:// <Name of the OSS bucket>/raster") // Specifies the OSS directory.
    val rf=spark.read.ganos.oss(options).loadLayer(uri)
    rf.show