|
21 | 21 | package org.locationtech.rasterframes |
22 | 22 | import geotrellis.proj4.CRS |
23 | 23 | import geotrellis.raster.reproject.Reproject |
24 | | -import geotrellis.raster.resample._ |
25 | 24 | import geotrellis.raster.{Tile, _} |
26 | 25 | import geotrellis.vector.Extent |
27 | 26 | import org.apache.spark.sql.functions.udf |
28 | 27 | import org.apache.spark.sql.{Row, SQLContext} |
29 | 28 | import org.locationtech.jts.geom.Geometry |
30 | 29 | import org.locationtech.rasterframes.encoders.CatalystSerializer._ |
| 30 | +import org.locationtech.rasterframes.util.ResampleMethod |
31 | 31 |
|
32 | 32 | /** |
33 | 33 | * Module utils. |
@@ -108,20 +108,9 @@ package object functions { |
108 | 108 | val leftCRS = leftCRSEnc.to[CRS] |
109 | 109 | lazy val rightExtents = rightExtentEnc.map(_.to[Extent]) |
110 | 110 | lazy val rightCRSs = rightCRSEnc.map(_.to[CRS]) |
111 | | - lazy val resample = resampleMethod //.getString(0) |
112 | | - .toLowerCase().trim().replaceAll("_", "") match { |
113 | | - case "nearestneighbor" | "nearest" ⇒ NearestNeighbor |
114 | | - case "bilinear" ⇒ Bilinear |
115 | | - case "cubicconvolution" ⇒ CubicConvolution |
116 | | - case "cubicspline" ⇒ CubicSpline |
117 | | - case "lanczos" | "lanzos" ⇒ Lanczos |
118 | | - // aggregates |
119 | | - case "average" ⇒ Average |
120 | | - case "mode" ⇒ Mode |
121 | | - case "median" ⇒ Median |
122 | | - case "max" ⇒ Max |
123 | | - case "min" ⇒ Min |
124 | | - case "sum" ⇒ Sum |
| 111 | + lazy val resample = resampleMethod match { |
| 112 | + case ResampleMethod(mm) ⇒ mm |
| 113 | + case _ ⇒ throw new IllegalArgumentException(s"Unable to parse ResampleMethod for ${resampleMethod}.") |
125 | 114 | } |
126 | 115 |
|
127 | 116 | if (leftExtent == null || leftDims == null || leftCRS == null) null |
|
0 commit comments