1
给定GeoTrellis中的RDD[(SpatialKey, Tile)]
,如何计算聚合KeyBounds[SpatialKey]
?动态确定GeoTrellis中的聚合KeyBounds
给定GeoTrellis中的RDD[(SpatialKey, Tile)]
,如何计算聚合KeyBounds[SpatialKey]
?动态确定GeoTrellis中的聚合KeyBounds
对于任何RDD[(K, V])]
其中K为Boundable,即有范围的隐含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 _)
将工作。