Hey Rob,
Thanks for the quick pointer. I have been looking deeper into the TileFeature class and the tileToLayout implicit method. As you recommended, the TileFeature class fits exactly what we want but I am having trouble getting the toTileLayout method to work over the type: RDD[(ProjectedExtent, TileFeature[Tile, CustomMetadata])]
I keep getting compilation errors. I pasted some sample code below (the first test method compiles but the second does not):
package tmptest
import geotrellis.raster.{CellType, Tile, TileFeature}
import geotrellis.vector.ProjectedExtent
import org.apache.spark.rdd.RDD
import geotrellis.spark.tiling.LayoutDefinition
import geotrellis.spark._
class TestClass {
def runTileToLayoutCompiles(): Unit = {
val cellType: CellType = null
val layoutDefinition: LayoutDefinition = null
val test1: RDD[(ProjectedExtent, Tile)] = null
val output1: RDD[(SpatialKey, Tile)] = test1.tileToLayout(cellType, layoutDefinition)
}
def runTileToLayoutCompileErrors(): Unit = {
val cellType: CellType = null
val layoutDefinition: LayoutDefinition = null
val test2: RDD[(ProjectedExtent, TileFeature[Tile, CustomMetadata])] = null
val output2: RDD[(SpatialKey, TileFeature[Tile, CustomMetadata])] = test2.tileToLayout(cellType, layoutDefinition)
}
}
case class CustomMetadata() {
}
[error] .../tmptest/TestClass.scala:24: value tileToLayout is not a member of org.apache.spark.rdd.RDD[(geotrellis.vector.ProjectedExtent, geotrellis.raster.TileFeature[geotrellis.raster.Tile,tmptest.CustomMetadata])]
[error] val output2: RDD[(SpatialKey, TileFeature[Tile, CustomMetadata])] = test2.tileToLayout(cellType, layoutDefinition)
I searched through the code and the TilerMethods class seems to be the only one that defines the 'tileToLayout' method. However in those method definitions I see no hint for the restrictions on the class type: