Skip to content

Commit dfff1b5

Browse files
committed
Make LayoutDefinition and SpatialKey codecs lazy
1 parent 570d8d5 commit dfff1b5

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

layer/src/main/scala/geotrellis/layer/LayoutDefinition.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ package geotrellis.layer
1919
import geotrellis.raster._
2020
import geotrellis.vector._
2121
import spire.math.Integral
22-
import _root_.io.circe.generic.JsonCodec
22+
import _root_.io.circe.{Encoder, Decoder}
23+
import _root_.io.circe.generic.semiauto.{deriveEncoder, deriveDecoder}
2324

2425
/**
2526
* Defines tiled raster layout
2627
* @param extent extent covered by the layout tiles, could be greater than extent of data in the layer
2728
* @param tileLayout tile layout (tile cols, tile rows, tile pixel size)
2829
*/
29-
@JsonCodec
3030
case class LayoutDefinition(override val extent: Extent, tileLayout: TileLayout) extends GridExtent[Long](extent, tileLayout.cellSize(extent)) {
3131

3232
/** Transformation between tile addressing and map coordinate addressing for for this layout */
@@ -70,6 +70,10 @@ case class LayoutDefinition(override val extent: Extent, tileLayout: TileLayout)
7070
}
7171

7272
object LayoutDefinition {
73+
// TODO: revert back to the @JsonCodec once we don't need Shapeless 2.3.3 compatibility
74+
implicit lazy val layoutDefinitionEncoder: Encoder[LayoutDefinition] = deriveEncoder
75+
implicit lazy val layoutDefinitionDecoder: Decoder[LayoutDefinition] = deriveDecoder
76+
7377
/**
7478
* Divides given RasterExtent into a TileLayout given a required tileSize.
7579
* Since padding may be required on the lower/right tiles to preserve the original resolution of the

layer/src/main/scala/geotrellis/layer/SpatialKey.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ case class SpatialKey(col: Int, row: Int) extends Product2[Int, Int] {
3131
}
3232

3333
object SpatialKey {
34+
// TODO: revert back to the @JsonCodec once we don't need Shapeless 2.3.3 compatibility
3435
implicit lazy val spatialKeyEncoder: Encoder[Extent] = deriveEncoder
3536
implicit lazy val spatialKeyDecoder: Decoder[Extent] = deriveDecoder
3637

vector/src/main/scala/geotrellis/vector/conf/JtsConfig.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ object JtsConfig {
4545
lazy val conf: JtsConfig = try {
4646
ConfigSource.default.at("geotrellis.jts").loadOrThrow[JtsConfig]
4747
} catch {
48-
// Shapeless 2.3.3 compatibility
48+
// TODO: remove once we don't need Shapeless 2.3.3 compatibility
4949
case e: NoSuchMethodError =>
5050
logger.warn(e)("NoSuchMethodError happened, probably due to the Shapeless versions mismatch, using the default configuration.")
5151
JtsConfig()

vector/src/main/scala/geotrellis/vector/io/json/CrsFormats.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import geotrellis.proj4.CRS
2525

2626
/** A trait specifying CRS/JSON conversion */
2727
trait CrsFormats {
28+
// TODO: revert back to the @JsonCodec once we don't need Shapeless 2.3.3 compatibility
2829
implicit lazy val crsEncoder: Encoder[CRS] =
2930
Encoder.encodeString.contramap[CRS] { _.toProj4String }
3031

0 commit comments

Comments
 (0)