All Downloads are FREE. Search and download functionalities are using the official Maven repository.

geotrellis.spark.etl.OutputPlugin.scala Maven / Gradle / Ivy

Go to download

GeoTrellis is an open source geographic data processing engine for high performance applications.

The newest version!
package geotrellis.spark.etl

import geotrellis.spark.{Metadata, LayerId, TileLayerRDD}
import geotrellis.spark.io.{Writer, AttributeStore}
import geotrellis.spark.io.index.KeyIndexMethod

import org.apache.spark.SparkContext
import org.apache.spark.rdd.RDD

import spray.json.JsonFormat

trait OutputPlugin[K, V, M] extends Plugin {
  def name: String

  def attributes(props: Parameters): AttributeStore

  def writer(method: KeyIndexMethod[K], props: Parameters)(implicit sc: SparkContext): Writer[LayerId, RDD[(K, V)] with Metadata[M]]

  def apply(id: LayerId, rdd: RDD[(K, V)] with Metadata[M], method: KeyIndexMethod[K], props: Map[String, String]): Unit = {
    implicit val sc = rdd.sparkContext
    writer(method, props).write(id, rdd)
  }

  def validate(props: Map[String, String]) =
    requireKeys(name, props, requiredKeys)

  def suitableFor(name: String): Boolean =
    name.toLowerCase == this.name
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy