astraea.spark.rasterframes.functions.LocalMeanAggregateFunction.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of raster-frames_2.11 Show documentation
Show all versions of raster-frames_2.11 Show documentation
RasterFrames brings the power of Spark DataFrames to geospatial raster data, empowered by the map algebra and tile layer operations of GeoTrellis
The newest version!
package astraea.spark.rasterframes.functions
import org.apache.spark.sql.Row
import org.apache.spark.sql.gt.types.TileUDT
import org.apache.spark.sql.types.DataType
/**
* Aggregation function that only returns the average. Depends on
* [[LocalStatsAggregateFunction]] for computation and just
* selects the mean result tile.
*
* @since 8/11/17
*/
class LocalMeanAggregateFunction extends LocalStatsAggregateFunction {
override def dataType: DataType = new TileUDT()
override def evaluate(buffer: Row): Any = {
val superRow = super.evaluate(buffer).asInstanceOf[Row]
if (superRow != null) superRow.get(3) else null
}
}