动态确定 GeoTrellis 中的聚合 KeyBound
Dynamically determine aggregate KeyBounds in GeoTrellis
给定 GeoTrellis 中的 RDD[(SpatialKey, Tile)]
,我如何计算聚合 KeyBounds[SpatialKey]
?
对于 K 为 Boundable 的任何 RDD[(K, V])]
,即作用域中存在隐含的 Boundable[K]
,您可以执行以下操作:
val bounds: KeyBounds[K] =
tiles.map({ case (key, _) => KeyBounds(key, key) }).reduce(_ combine _)
这将适用于 SpatialKey
和 SpaceTimeKey
,因为 GeoTrellis 为这些类型提供了隐式 Boundable 类型类。所以在你的情况下,
val bounds: KeyBounds[SpatialKey] =
tiles.map({ case (key, _) => KeyBounds(key, key) }).reduce(_ combine _)
会起作用。
给定 GeoTrellis 中的 RDD[(SpatialKey, Tile)]
,我如何计算聚合 KeyBounds[SpatialKey]
?
对于 K 为 Boundable 的任何 RDD[(K, V])]
,即作用域中存在隐含的 Boundable[K]
,您可以执行以下操作:
val bounds: KeyBounds[K] =
tiles.map({ case (key, _) => KeyBounds(key, key) }).reduce(_ combine _)
这将适用于 SpatialKey
和 SpaceTimeKey
,因为 GeoTrellis 为这些类型提供了隐式 Boundable 类型类。所以在你的情况下,
val bounds: KeyBounds[SpatialKey] =
tiles.map({ case (key, _) => KeyBounds(key, key) }).reduce(_ combine _)
会起作用。