-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LayoutTileSource[K] implementation #220
Conversation
70a238a
to
6556cc2
Compare
This is a first attempt to resolve the problem of extending the API to support temporal keys. |
6556cc2
to
35b9899
Compare
vlm/src/main/scala/geotrellis/contrib/vlm/spark/RasterSourceRDD.scala
Outdated
Show resolved
Hide resolved
vlm/src/main/scala/geotrellis/contrib/vlm/spark/RasterSourceRDD.scala
Outdated
Show resolved
Hide resolved
vlm/src/main/scala/geotrellis/contrib/vlm/spark/RasterSourceRDD.scala
Outdated
Show resolved
Hide resolved
35b9899
to
a09736e
Compare
a09736e
to
ec392e3
Compare
vlm/src/main/scala/geotrellis/contrib/vlm/TileToLayoutRasterSource.scala
Outdated
Show resolved
Hide resolved
c8b35e0
to
b32f766
Compare
4e99506
to
7d7b125
Compare
7d7b125
to
55355e1
Compare
291981e
to
867f598
Compare
gdal/src/test/scala/geotrellis/contrib/vlm/spark/GDALRasterSummarySpec.scala
Show resolved
Hide resolved
d0d4e76
to
5f15b16
Compare
* In order to fit to the given layout, the source data is resampled to match the Extent | ||
* and CellSize of the layout. | ||
*/ | ||
trait TileToLayout[K] extends Serializable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TileToLayout
has to be a type class to choose the instance in compile time depending on the Key type.
5f15b16
to
787c823
Compare
|
||
val cellType = cellTypes.head | ||
val crs = projections.head | ||
def read( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added lots of fancy overloads to hide type parameters from places where they are not necessary.
) | ||
} | ||
} | ||
|
||
object RasterSummary { | ||
/** Collect [[RasterSummary]] from unstructred rasters, grouped by CRS */ | ||
def collect[V <: CellGrid[N]: GetComponent[?, ProjectedExtent], N: Integral](rdd: RDD[V]): Seq[RasterSummary] = { | ||
def collect[K: SpatialComponent: Boundable](rdd: RDD[RasterSource], keyTransform: (RasterSource, SpatialKey) => K): Seq[RasterSummary[K]] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It still has to be a RasterSource
and not it's metadata, as we don't pass the tile path as a part of the metadata information. I think it will be resolved in terms of #197 as here we have to decide what to do with path and what if we want to give some name to the raster source that is different from the path (to follow the GDALDataset names logic).
}) | ||
|
||
// collect raster summary | ||
val summary = RasterSummary.fromRDD(sourceRDD, keyTransform) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To collect RasterSummary[SpatialKey]
we can use RasterSummary.fromRDD(sourceRDD)
, for temporal and other K
types we can just add a keyTransform
function definition.
This PR tries to minimize global changes in the code as we want to include these changes into the release. The core problem is the metadata collection step, and the way it is done now is a little bit complicated (talking about the API ~ as it is pretty hard to explain to users that they need to collect some Much more sense makes to have some sort of a |
787c823
to
008748c
Compare
008748c
to
453df75
Compare
669d41f
to
bdd8bfd
Compare
bdd8bfd
to
fc45c29
Compare
} | ||
} | ||
|
||
trait TemporalKeyExtractor extends KeyExtractor[SpaceTimeKey] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For when this code moves around: TemporalKeyExtractor
and spatialKeyExtractor
should both be classes for members of KeyExtractor
companion object to maximize uniformity and minimize surprise.
Overview
This PR adds an ability to work with temporal keys and RasterSources
Checklist
Closes #182