The source of the issue is running into cases where I needed to override GDALRasterSource and MosaicRasterSource methods for application specific reasons. However, that is not possible because GDALRasterSource is a case class and can't be extended and MosaicRasterSource is a trait and its constructor isn't accessible (more on this later).
Here is my list of reasons why our RasterSource should not be case class.
- It is not a case class. Case class is supposed to be a named data container with light functionality, that has meaningful equality and can be matched against.
RasterSource represents a set of rich I/O functionality and is basically the furthest thing from "data container".
- Many RasterSources don't have meaningful
unapply:
|
class GeotrellisResampleRasterSource( |
is a great example. It has multiple constructors
- Sometimes it's reasonable to override
RasterSource methods. I don't know why exactly but changing the behavior under reproject or resample are at least two perfectly reasonable things to do. Why require creating an adapter?
- Controlling
toString. With as much crud as we shove into the conductors the case class toString implementation becomes unhelpful.
- The case class equality does not have a clear and unsurprising meaning for lots of RasterSources. Are two GeoTiffRasterSources equal only if they share the same
baseTiff or if they point to the same source file with the same "view" (CRS/pixelGrid) of the data?
The source of the issue is running into cases where I needed to
overrideGDALRasterSourceandMosaicRasterSourcemethods for application specific reasons. However, that is not possible becauseGDALRasterSourceis a case class and can't be extended andMosaicRasterSourceis a trait and its constructor isn't accessible (more on this later).Here is my list of reasons why our
RasterSourceshould not be case class.RasterSourcerepresents a set of rich I/O functionality and is basically the furthest thing from "data container".unapply:geotrellis-contrib/vlm/src/main/scala/geotrellis/contrib/vlm/avro/GeotrellisResampleRasterSource.scala
Line 46 in 07a5955
RasterSourcemethods. I don't know why exactly but changing the behavior under reproject or resample are at least two perfectly reasonable things to do. Why require creating an adapter?toString. With as much crud as we shove into the conductors thecase classtoStringimplementation becomes unhelpful.baseTiffor if they point to the same source file with the same "view" (CRS/pixelGrid) of the data?