locationtech / geotrellis

GeoTrellis is a geographic data processing engine for high performance applications.
http://geotrellis.io
Other
1.33k stars 362 forks source link

How to init TileLayerRDD with a piece of extent #3473

Closed jhxfcen closed 2 years ago

jhxfcen commented 2 years ago

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))
pomadchin commented 2 years ago

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 ._.

pomadchin commented 2 years ago

@jhxfcen I brought up a PR that will hopefully get merged soon, https://github.com/locationtech/geotrellis/pull/3474