/
Implicits.scala
49 lines (45 loc) · 1.49 KB
/
Implicits.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package geotrellis.spark.cog
import geotrellis.raster._
import geotrellis.raster.crop._
import geotrellis.raster.io.geotiff._
import geotrellis.spark._
import geotrellis.spark.tiling._
object Implicits extends Implicits
trait Implicits {
implicit class withSinglebandGeoTiffConstructMethods(val self: Tile) extends GeoTiffConstructMethods[Tile] {
def toGeoTiff[K](
nextLayout: LayoutDefinition,
gb: GridBounds,
md: TileLayerMetadata[K],
options: GeoTiffOptions,
overviews: List[GeoTiff[Tile]] = Nil
): SinglebandGeoTiff = {
SinglebandGeoTiff(
GeoTiffTile(self.crop(nextLayout.mapTransform(gb), md.extent, Crop.Options(clamp = false)), options),
md.extent,
md.crs,
Tags.empty,
options = options,
overviews = overviews.map(_.asInstanceOf[SinglebandGeoTiff])
)
}
}
implicit class withMultibandGeoTiffConstructMethods(val self: MultibandTile) extends GeoTiffConstructMethods[MultibandTile] {
def toGeoTiff[K](
nextLayout: LayoutDefinition,
gb: GridBounds,
md: TileLayerMetadata[K],
options: GeoTiffOptions,
overviews: List[GeoTiff[MultibandTile]] = Nil
): MultibandGeoTiff = {
MultibandGeoTiff(
GeoTiffMultibandTile(self.crop(nextLayout.mapTransform(gb), md.extent, Crop.Options(clamp = false)), options),
md.extent,
md.crs,
Tags.empty,
options = options,
overviews.map(_.asInstanceOf[MultibandGeoTiff])
)
}
}
}