diff --git a/CHANGELOG.md b/CHANGELOG.md index 37ae9caba0..d7a0633737 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Disambiguate withBufferTileFocalMethods implicit preserving bin compatibility [#3422](https://github.com/locationtech/geotrellis/pull/3422) - Specialize Grid for Int and Long [#3428](https://github.com/locationtech/geotrellis/pull/3428) - Move GeoWave and GeoMesa subproject to their own repositories [#3439](https://github.com/locationtech/geotrellis/pull/3439) +- Use JTS 1.18, GeoTools 25.0 [#3437](https://github.com/locationtech/geotrellis/pull/3437) ## [3.6.0] - 2021-04-30 diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 696b173326..5c1ea44056 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -17,7 +17,7 @@ import sbt._ object Version { - val geotools = "23.3" + val geotools = "25.0" val spire = "0.17.0" val accumulo = "1.9.3" val cassandra = "3.7.2" @@ -72,7 +72,7 @@ object Dependencies { val scalatest = "org.scalatest" %% "scalatest" % "3.2.5" val scalacheck = "org.scalacheck" %% "scalacheck" % "1.15.2" val scalaXml = "org.scala-lang.modules" %% "scala-xml" % "1.3.0" - val jts = "org.locationtech.jts" % "jts-core" % "1.17.0" + val jts = "org.locationtech.jts" % "jts-core" % "1.18.1" val proj4j = "org.locationtech.proj4j" % "proj4j" % "1.1.3" val openCSV = "com.opencsv" % "opencsv" % "5.3" val spire = "org.typelevel" %% "spire" % Version.spire diff --git a/spark-pipeline/src/main/scala/geotrellis/spark/pipeline/json/Implicits.scala b/spark-pipeline/src/main/scala/geotrellis/spark/pipeline/json/Implicits.scala index 80f8c8577f..09eceb6d14 100644 --- a/spark-pipeline/src/main/scala/geotrellis/spark/pipeline/json/Implicits.scala +++ b/spark-pipeline/src/main/scala/geotrellis/spark/pipeline/json/Implicits.scala @@ -62,8 +62,8 @@ trait Implicits { Either.catchNonFatal(Try(CRS.fromName(str)) getOrElse CRS.fromString(str)).leftMap(_ => "CRS") } - implicit val layoutDefinitionEncoder: Encoder[LayoutDefinition] = deriveEncoder - implicit val layoutDefinitionDecoder: Decoder[LayoutDefinition] = deriveDecoder + implicit val layoutDefinitionEncoder: Encoder[LayoutDefinition] = deriveConfiguredEncoder + implicit val layoutDefinitionDecoder: Decoder[LayoutDefinition] = deriveConfiguredDecoder implicit val layoutSchemeEncoder: Encoder[LayoutScheme] = Encoder.instance { diff --git a/spark-pipeline/src/main/scala/geotrellis/spark/pipeline/package.scala b/spark-pipeline/src/main/scala/geotrellis/spark/pipeline/package.scala index 1a624413ae..460a5bd631 100644 --- a/spark-pipeline/src/main/scala/geotrellis/spark/pipeline/package.scala +++ b/spark-pipeline/src/main/scala/geotrellis/spark/pipeline/package.scala @@ -36,7 +36,7 @@ package object pipeline extends json.Implicits with ast.untyped.Implicits { } implicit class withPipelinePrettyPrint(that: Node[_]) { - def prettyPrint: String = that.asJson.asJson.pretty(pipelineJsonPrinter) + def prettyPrint: String = that.asJson.asJson.printWith(pipelineJsonPrinter) } implicit class withGetCRS[T <: { def crs: String }](o: T) { diff --git a/spark/src/main/scala/geotrellis/spark/reproject/TileRDDReproject.scala b/spark/src/main/scala/geotrellis/spark/reproject/TileRDDReproject.scala index 7987127e19..142c109208 100644 --- a/spark/src/main/scala/geotrellis/spark/reproject/TileRDDReproject.scala +++ b/spark/src/main/scala/geotrellis/spark/reproject/TileRDDReproject.scala @@ -23,11 +23,10 @@ import geotrellis.raster.buffer.{BufferSizes, BufferedTile} import geotrellis.raster.crop._ import geotrellis.raster.merge._ import geotrellis.raster.prototype._ -import geotrellis.raster.reproject._ +import geotrellis.raster.reproject.{ReprojectRasterExtent, RasterRegionReproject} import geotrellis.raster.stitch._ import geotrellis.spark._ import geotrellis.spark.buffer.BufferTilesRDD -import geotrellis.spark.reproject.Reproject import geotrellis.vector._ import geotrellis.util._ diff --git a/spark/src/main/scala/geotrellis/spark/summary/polygonal/RDDPolygonalSummary.scala b/spark/src/main/scala/geotrellis/spark/summary/polygonal/RDDPolygonalSummary.scala index 388cbb8be1..be23afcc06 100644 --- a/spark/src/main/scala/geotrellis/spark/summary/polygonal/RDDPolygonalSummary.scala +++ b/spark/src/main/scala/geotrellis/spark/summary/polygonal/RDDPolygonalSummary.scala @@ -79,7 +79,7 @@ object RDDPolygonalSummary { val extent: Extent = layout.mapTransform.keyToExtent(spatialKey) val raster: Raster[T] = Raster(tile, extent) val result: PolygonalSummaryResult[R] = - raster.polygonalSummary(feature.geom, visitor.getClass.newInstance, options) + raster.polygonalSummary(feature.geom, visitor.getClass.getDeclaredConstructor().newInstance(), options) (feature.data, Feature(feature.geom, result)) } } diff --git a/spark/src/test/scala/geotrellis/spark/mask/TileRDDMaskMethodsSpec.scala b/spark/src/test/scala/geotrellis/spark/mask/TileRDDMaskMethodsSpec.scala index 2ad3e7c4d7..38c109e214 100644 --- a/spark/src/test/scala/geotrellis/spark/mask/TileRDDMaskMethodsSpec.scala +++ b/spark/src/test/scala/geotrellis/spark/mask/TileRDDMaskMethodsSpec.scala @@ -191,17 +191,18 @@ class TileRDDMaskMethodsSpec extends AnyFunSpec with Matchers with TestEnvironme it ("should be masked by complex multipolygons") { val cases = Seq( MultiPolygon( - Polygon(LineString(Seq[(Double,Double)]((29, 15), (110, 15), (110, 96), (29, 15))), + Polygon(LineString(Seq[(Double,Double)]((50, 30), (110, 15), (110, 96), (50, 30))), LineString(Seq[(Double,Double)]((69, 42), (96, 42), (96, 69), (69, 42)))), Polygon(LineString(Seq[(Double,Double)]((-77, -78), (46, -78), (46, 45), (-77, -78))), LineString(Seq[(Double,Double)]((-16, -37), (25, -37), (25, 4), (-16, -37))))), MultiPolygon( Polygon(LineString(Seq[(Double,Double)]((-41, -17), (0, -17), (0, 24), (-41, -17))), LineString(Seq[(Double,Double)]((-21, -4), (-8, -4), (-8, 9), (-21, -4)))), - Polygon(LineString(Seq[(Double,Double)]((-83, -76), (-13, -76), (-13, -6), (-83, -76))), + Polygon(LineString(Seq[(Double,Double)]((-83, -76), (-13, -76), (-13, -20), (-83, -76))), LineString(Seq[(Double,Double)]((-48, -53), (-25, -53), (-25, -30), (-48, -53))))) ) cases foreach { multipoly => + require(multipoly.isValid(), s"Invalid Geom: ${multipoly.toWKT()}") val masked = rdd.mask(multipoly, options = opts).stitch() val expected = tile.mask(worldExt, multipoly) masked.tile.toArray() shouldEqual expected.toArray() diff --git a/store/src/main/scala/geotrellis/store/hadoop/util/HdfsUtils.scala b/store/src/main/scala/geotrellis/store/hadoop/util/HdfsUtils.scala index 5b88b5e87d..c1dbe3a228 100644 --- a/store/src/main/scala/geotrellis/store/hadoop/util/HdfsUtils.scala +++ b/store/src/main/scala/geotrellis/store/hadoop/util/HdfsUtils.scala @@ -61,7 +61,7 @@ object HdfsUtils { if(!fs.exists(path)) fs.mkdirs(path) else - if(!fs.isDirectory(path)) sys.error(s"Directory $path does not exist on ${fs.getUri}") + if(!fs.getFileStatus(path).isDirectory()) sys.error(s"Directory $path does not exist on ${fs.getUri}") } def deletePath(path: Path, conf: Configuration): Unit = { diff --git a/store/src/main/scala/geotrellis/store/index/hilbert/HilbertSpaceTimeKeyIndex.scala b/store/src/main/scala/geotrellis/store/index/hilbert/HilbertSpaceTimeKeyIndex.scala index 4ceb805f42..70658d15a7 100644 --- a/store/src/main/scala/geotrellis/store/index/hilbert/HilbertSpaceTimeKeyIndex.scala +++ b/store/src/main/scala/geotrellis/store/index/hilbert/HilbertSpaceTimeKeyIndex.scala @@ -58,7 +58,7 @@ class HilbertSpaceTimeKeyIndex( val minKey = keyBounds.minKey.spatialKey @transient lazy val chc = { - val dimensionSpec = new MultiDimensionalSpec(List(xResolution, yResolution, temporalResolution).map(new java.lang.Integer(_)).asJava) + val dimensionSpec = new MultiDimensionalSpec(List(xResolution, yResolution, temporalResolution).map(java.lang.Integer.valueOf(_)).asJava) new CompactHilbertCurve(dimensionSpec) } diff --git a/store/src/main/scala/geotrellis/store/index/hilbert/HilbertSpatialKeyIndex.scala b/store/src/main/scala/geotrellis/store/index/hilbert/HilbertSpatialKeyIndex.scala index f1192ee236..f3cf91eeb8 100644 --- a/store/src/main/scala/geotrellis/store/index/hilbert/HilbertSpatialKeyIndex.scala +++ b/store/src/main/scala/geotrellis/store/index/hilbert/HilbertSpatialKeyIndex.scala @@ -50,7 +50,7 @@ class HilbertSpatialKeyIndex(val keyBounds: KeyBounds[SpatialKey], val xResoluti val minKey = keyBounds.minKey @transient lazy val chc = { - val dimensionSpec = new MultiDimensionalSpec(List(xResolution, yResolution).map(new java.lang.Integer(_)).asJava) + val dimensionSpec = new MultiDimensionalSpec(List(xResolution, yResolution).map(java.lang.Integer.valueOf(_)).asJava) new CompactHilbertCurve(dimensionSpec) } diff --git a/vector/src/main/scala/geotrellis/vector/Results.scala b/vector/src/main/scala/geotrellis/vector/Results.scala index f154c2bb87..803f949f12 100644 --- a/vector/src/main/scala/geotrellis/vector/Results.scala +++ b/vector/src/main/scala/geotrellis/vector/Results.scala @@ -234,6 +234,7 @@ object MultiPointMultiLineStringUnionResult { geom match { case g: Geometry if g.isEmpty => NoResult case l: LineString => LineStringResult(l) + case pt: Point => PointResult(pt) case mp: MultiPoint => MultiPointResult(mp) case ml: MultiLineString => MultiLineStringResult(ml) case gc: GeometryCollection => GeometryCollectionResult(gc) @@ -331,6 +332,7 @@ object MultiPointMultiPolygonUnionResult { geom match { case g: Geometry if g.isEmpty => NoResult case p: Polygon => PolygonResult(p) + case pt: Point => PointResult(pt) case mpt: MultiPoint => MultiPointResult(mpt) case mp: MultiPolygon => MultiPolygonResult(mp) case gc: GeometryCollection => GeometryCollectionResult(gc) @@ -780,6 +782,8 @@ case class PointResult(geom: Point) extends GeometryResult with MultiLineStringMultiLineStringDifferenceResult with MultiPointMultiPointDifferenceResult with MultiPolygonMultiPolygonDifferenceResult + with MultiPointMultiPolygonUnionResult + with MultiPointMultiLineStringUnionResult with PointOrNoResult { def toGeometry(): Option[Geometry] = Some(geom) } diff --git a/vector/src/test/scala/geotrellis/vector/MultiPointSpec.scala b/vector/src/test/scala/geotrellis/vector/MultiPointSpec.scala index 10607c5cb6..9078f5dd8f 100644 --- a/vector/src/test/scala/geotrellis/vector/MultiPointSpec.scala +++ b/vector/src/test/scala/geotrellis/vector/MultiPointSpec.scala @@ -128,7 +128,7 @@ class MultiPointSpec extends AnyFunSpec with Matchers { it ("should union with an empty MultiPoint and return a MultiPointResult") { val mp1 = MultiPoint(Point(1,1)) val mp2 = MultiPoint.EMPTY - mp1 | mp2 should be (MultiPointResult(Seq(Point(1,1)).toMultiPoint)) + mp1 | mp2 shouldBe PointResult(Point(1,1)) } it ("should union with a MultiPoint and return a PointResult") { @@ -158,7 +158,7 @@ class MultiPointSpec extends AnyFunSpec with Matchers { it ("should union with an empty MultiLineString and return a MultiPointResult") { val mp = MultiPoint(Seq(Point(1,1))) val ml = MultiLineString(Seq()) - mp | ml should be (MultiPointResult(Seq(Point(1,1)).toMultiPoint)) + mp | ml shouldBe PointResult(Point(1,1)) } it ("should union with a MultiLineString and return a MultiPoint") { @@ -188,7 +188,7 @@ class MultiPointSpec extends AnyFunSpec with Matchers { it ("should union with an empty MultiPolygon and return a MultiPointResult") { val mpt = MultiPoint(Seq(Point(1,1))) val mp = MultiPolygon(Seq()) - mpt | mp should be (MultiPointResult(Seq(Point(1,1)).toMultiPoint)) + mpt | mp shouldBe PointResult(Point(1,1)) } it ("should union with a MultiPolygon and return a PolygonResult") { diff --git a/version.sbt b/version.sbt index d726429f71..f5c9d0c051 100644 --- a/version.sbt +++ b/version.sbt @@ -1 +1 @@ -ThisBuild / version := "3.6.1-SNAPSHOT" +ThisBuild / version := "3.7.0-SNAPSHOT"