locationtech/geotrellis

How to init TileLayerRDD with a piece of extent

jhxfcen opened this issue · 2 comments

below is a regular process to create a TileLayerRDD, but we don't want to load the whole extent of this image, just want to load a piece of extent, how to do it?

val image1 = "/Desktop/test/LC08_L2SP_126032_20220408_20220412_02_T1_SR_B2.TIF"

val rs = GeoTiffRasterSource(image1).reproject(LatLng)

val source: RDD[RasterSource] = sparkContext.parallelize(rs :: Nil)

val summary = RasterSummary.fromRDD(source)

val layoutScheme = ZoomedLayoutScheme(LatLng, 512)

val LayoutLevel(zoom, layout) = summary.levelFor(layoutScheme)

val rdd = RasterSourceRDD.tiledLayerRDD(source, layout, KeyExtractor.spatialKeyExtractor, rasterSummary = Some(summary))

Hey @jhxfcen that's a good question, I don't think this functionality is exposed. At this point that's available as a part of the old API only. But it could be a nice addition indeed.

I'm actually surprised we never faced this need ._.

@jhxfcen I brought up a PR that will hopefully get merged soon, #3474