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

astraea.spark.rasterframes.expressions.GeomDeserializerSupport.scala Maven / Gradle / Ivy

Go to download

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.expressions

import com.vividsolutions.jts.geom.Geometry
import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.catalyst.expressions.Expression
import org.apache.spark.sql.jts.AbstractGeometryUDT

/**
 * Support for deserializing JTS geometry inside expressions.
 *
 * @since 2/22/18
 */
trait GeomDeserializerSupport {
  def extractGeometry(expr: Expression, input: Any): Geometry = {
    input match {
      case g: Geometry ⇒ g
      case r: InternalRow ⇒
        expr.dataType match {
          case udt: AbstractGeometryUDT[_] ⇒ udt.deserialize(r)
        }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy