I have a TileLayerRDD[SpatialKey] and am generating an image pyramid with the following code snippet:
def savePng(
layer: TileLayerRDD[SpatialKey],
colorMap: ColorMap,
outputPath: String
): Unit = {
implicit val sc: SparkContext = layer.sparkContext
val (baseZoom, baseLayer) = layer.reproject(ZoomedLayoutScheme(WebMercator, 256))
val pyramid = Pyramid.fromLayerRDD(
baseLayer,
Some(baseZoom),
Some(0),
resampleMethod = ResampleMethods.Max
)
pyramid.levels.foreach { case (zoom, tileRdd) =>
val imageRdd: RDD[(SpatialKey, Array[Byte])] =
tileRdd.mapValues(_.renderPng(colorMap).bytes)
val keyToPath = { k: SpatialKey => s"${outputPath}/${zoom}/${k.col}/${k.row}.png" }
if (outputPath.startsWith("s3")) {
SaveToS3(imageRdd, keyToPath, { request =>
request.toBuilder.acl(ObjectCannedACL.PUBLIC_READ).build()
})
} else {
SaveToHadoop(imageRdd, keyToPath)
}
}
}
When this layer is generated and displayed on a map, all zoom levels past the base zoom level replace nodata values with the value of the first color ramp:
https://tilejson.io/g/90e81c9fd2ed500609829d5df5af93dc/view
When I use the default ResampleMethod.Average this does not occur. It appears that MaxResample handles NoData values correctly
I have a
TileLayerRDD[SpatialKey]and am generating an image pyramid with the following code snippet:When this layer is generated and displayed on a map, all zoom levels past the base zoom level replace nodata values with the value of the first color ramp:
https://tilejson.io/g/90e81c9fd2ed500609829d5df5af93dc/view
When I use the default ResampleMethod.Average this does not occur. It appears that MaxResample handles NoData values correctly