This is an automated email from the ASF dual-hosted git repository. kontinuation pushed a commit to branch revert-java-11 in repository https://gitbox.apache.org/repos/asf/sedona.git
commit f6c8e4d918250165befca12dd3b4b31737496aee Author: Kristin Cowalcijk <[email protected]> AuthorDate: Mon May 13 15:15:46 2024 +0800 Revert "[SEDONA-551] Upgrade GeoTools dependency to 31.0 for Apache SIS integration and Drop Java 8 support (#1382)" This reverts commit e0aabe3452cf192a731794372d281201063f37ec. --- .github/workflows/docs.yml | 8 +++--- .github/workflows/java.yml | 20 +++++++++----- .github/workflows/python.yml | 2 +- .github/workflows/r.yml | 6 ++--- R/tests/testthat/test-data-interface-raster.R | 12 ++++++--- .../apache/sedona/common/FunctionsGeoTools.java | 10 +++---- .../sedona/common/raster/GeometryFunctions.java | 8 +++--- .../sedona/common/raster/PixelFunctionEditors.java | 9 ++++--- .../sedona/common/raster/PixelFunctions.java | 11 ++++---- .../sedona/common/raster/RasterAccessors.java | 8 +++--- .../sedona/common/raster/RasterBandAccessors.java | 2 +- .../sedona/common/raster/RasterBandEditors.java | 6 ++--- .../sedona/common/raster/RasterConstructors.java | 28 ++++++++++--------- .../raster/RasterConstructorsForTesting.java | 6 ++--- .../apache/sedona/common/raster/RasterEditors.java | 22 +++++++-------- .../apache/sedona/common/raster/RasterOutputs.java | 6 ++--- .../sedona/common/raster/RasterPredicates.java | 12 ++++----- .../sedona/common/raster/netcdf/NetCdfReader.java | 4 +-- .../sedona/common/raster/serde/CRSSerializer.java | 4 +-- .../apache/sedona/common/raster/serde/Serde.java | 2 +- .../common/utils/CachedCRSTransformFinder.java | 6 ++--- .../apache/sedona/common/utils/RasterUtils.java | 23 ++++++++-------- .../org/apache/sedona/common/FunctionsTest.java | 4 +-- .../sedona/common/raster/FunctionEditorsTest.java | 4 +-- .../apache/sedona/common/raster/FunctionsTest.java | 4 +-- .../common/raster/GeometryFunctionsTest.java | 4 +-- .../sedona/common/raster/MapAlgebraTest.java | 2 +- .../sedona/common/raster/RasterAccessorsTest.java | 4 +-- .../common/raster/RasterBandAccessorsTest.java | 4 +-- .../common/raster/RasterBandEditorsTest.java | 4 +-- .../common/raster/RasterConstructorsTest.java | 12 ++++----- .../sedona/common/raster/RasterEditorsTest.java | 22 +++++++-------- .../sedona/common/raster/RasterOutputTest.java | 2 +- .../sedona/common/raster/RasterPredicatesTest.java | 8 +++--- .../sedona/common/raster/RasterTestBase.java | 31 +++++++++++----------- .../common/raster/serde/CRSSerializerTest.java | 4 +-- .../sedona/common/raster/serde/SerdeTest.java | 2 +- docs/api/java-api.md | 2 +- docs/api/python-api.md | 1 + docs/api/viz/java-api.md | 2 +- docs/community/develop.md | 2 +- docs/community/release-manager.md | 14 +++++----- docs/community/vote.md | 2 +- docs/setup/cluster.md | 2 +- docs/setup/compile.md | 2 +- docs/setup/flink/platform.md | 2 +- docs/setup/platform.md | 2 +- docs/tutorial/demo.md | 2 +- .../apache/sedona/flink/expressions/Functions.java | 9 ++++--- .../flink/expressions/FunctionsGeoTools.java | 4 +-- .../java/org/apache/sedona/flink/FunctionTest.java | 4 +-- mkdocs.yml | 2 +- pom.xml | 2 +- python/tests/sql/test_dataframe_api.py | 2 +- .../sedona/snowflake/snowsql/GeoToolsWrapper.java | 4 +-- .../sedona/core/spatialOperator/KNNQuery.java | 4 +-- .../strategy/join/JoinedGeometryRaster.scala | 11 ++++---- .../shapefileParser/shapes/ShapefileRDDTest.java | 12 ++++----- .../shapes/ShapefileReaderTest.java | 14 +++++----- .../org/apache/sedona/sql/functionTestScala.scala | 2 +- 60 files changed, 225 insertions(+), 204 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index b1415266f..c5e6e7800 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -22,11 +22,11 @@ jobs: uses: actions/setup-java@v4 with: distribution: 'zulu' - java-version: '11' - - name: Compile Source Code - run: mvn -q clean install -DskipTests + java-version: '8' + - name: Compile JavaDoc + run: mvn -q clean install -DskipTests && mkdir -p docs/api/javadoc/spark && cp -r spark/common/target/apidocs/* docs/api/javadoc/spark/ - name: Compile ScalaDoc - run: mvn scala:doc -pl spark/common && mkdir -p docs/api/scaladoc/spark && cp -r spark/common/target/site/scaladocs/* docs/api/scaladoc/spark + run: mvn scala:doc && mkdir -p docs/api/scaladoc/spark && cp -r spark/common/target/site/scaladocs/* docs/api/scaladoc/spark - uses: actions/setup-python@v5 with: python-version: 3.x diff --git a/.github/workflows/java.yml b/.github/workflows/java.yml index 616e3e2d1..3d780c7ae 100644 --- a/.github/workflows/java.yml +++ b/.github/workflows/java.yml @@ -41,7 +41,11 @@ jobs: include: - spark: 3.5.0 scala: 2.13.8 - jdk: '11' + jdk: '8' + skipTests: '' + - spark: 3.5.0 + scala: 2.12.15 + jdk: '8' skipTests: '' - spark: 3.5.0 scala: 2.12.15 @@ -49,7 +53,11 @@ jobs: skipTests: '' - spark: 3.4.0 scala: 2.13.8 - jdk: '11' + jdk: '8' + skipTests: '' + - spark: 3.4.0 + scala: 2.12.15 + jdk: '8' skipTests: '' - spark: 3.4.0 scala: 2.12.15 @@ -57,19 +65,19 @@ jobs: skipTests: '' - spark: 3.3.0 scala: 2.12.15 - jdk: '11' + jdk: '8' skipTests: '' - spark: 3.2.3 scala: 2.12.15 - jdk: '11' + jdk: '8' skipTests: '' - spark: 3.1.2 scala: 2.12.15 - jdk: '11' + jdk: '8' skipTests: '' - spark: 3.0.3 scala: 2.12.15 - jdk: '11' + jdk: '8' skipTests: '' steps: diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index a5d623dd5..9e5546677 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -97,7 +97,7 @@ jobs: - uses: actions/setup-java@v4 with: distribution: 'zulu' - java-version: '11' + java-version: '8' - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} diff --git a/.github/workflows/r.yml b/.github/workflows/r.yml index b917479cb..199e03077 100644 --- a/.github/workflows/r.yml +++ b/.github/workflows/r.yml @@ -34,7 +34,7 @@ jobs: spark: [3.0.3, 3.1.2, 3.2.1, 3.3.0, 3.4.0, 3.5.0] hadoop: [3] scala: [2.12.15] - r: [oldrel] + r: [oldrel, release] env: SPARK_VERSION: ${{ matrix.spark }} @@ -86,7 +86,7 @@ jobs: - uses: actions/setup-java@v4 with: distribution: 'temurin' - java-version: '11' + java-version: '8' cache: 'maven' - name: Get OS name id: os-name @@ -106,7 +106,7 @@ jobs: if [ ${SPARK_VERSION:2:1} -gt "3" ]; then SPARK_COMPAT_VERSION=${SPARK_VERSION:0:3} fi - mvn -q clean install -DskipTests -Dspark=${SPARK_COMPAT_VERSION} -Dscala=${SCALA_VERSION:0:4} -Dgeotools + mvn -q clean install -DskipTests -Dspark=${SPARK_COMPAT_VERSION} -Dscala=${SCALA_VERSION:0:4} - name: Run tests run: | if [[ "${SPARK_VERSION:0:3}" < "3.3" ]]; then diff --git a/R/tests/testthat/test-data-interface-raster.R b/R/tests/testthat/test-data-interface-raster.R index 7290c5850..6bfd53b2a 100644 --- a/R/tests/testthat/test-data-interface-raster.R +++ b/R/tests/testthat/test-data-interface-raster.R @@ -132,7 +132,7 @@ test_that("Passed RS_Envelope with raster", { test_that("Passed RS_NumBands with raster", { ## Load sdf_name <- random_string("spatial_sdf") - binary_sdf <- spark_read_binary(sc, dir = test_data("raster/test3.tif"), name = sdf_name) + binary_sdf <- spark_read_binary(sc, dir = test_data("raster"), name = sdf_name) a <- binary_sdf %>% @@ -142,11 +142,14 @@ test_that("Passed RS_NumBands with raster", { ) %>% select(nbands) %>% collect() + expect_equal( a %>% as.list(), - list(nbands = c(4)) + list(nbands = c(1, 1, 4)) + ) + ## Cleanup sc %>% DBI::dbExecute(paste0("DROP TABLE ", sdf_name)) rm(a) @@ -182,7 +185,7 @@ test_that("Passed RS_Value with raster", { test_that("Passed RS_Values with raster", { ## Load sdf_name <- random_string("spatial_sdf") - binary_sdf <- spark_read_binary(sc, dir = test_data("raster/test1.tiff"), name = sdf_name) + binary_sdf <- spark_read_binary(sc, dir = test_data("raster"), name = sdf_name) a <- binary_sdf %>% @@ -192,9 +195,10 @@ test_that("Passed RS_Values with raster", { ) %>% select(val) %>% collect() + expect_equal( a %>% as.list(), - list(val = list(c(255, NA_real_))) + list(val = list(c(255, NA_real_), c(255, NA_real_), c(NA_real_, NA_real_))) ) diff --git a/common/src/main/java/org/apache/sedona/common/FunctionsGeoTools.java b/common/src/main/java/org/apache/sedona/common/FunctionsGeoTools.java index 4b15a639c..b47c5ce8f 100644 --- a/common/src/main/java/org/apache/sedona/common/FunctionsGeoTools.java +++ b/common/src/main/java/org/apache/sedona/common/FunctionsGeoTools.java @@ -23,11 +23,11 @@ import org.locationtech.jts.geom.GeometryFactory; import org.locationtech.jts.operation.buffer.BufferOp; import org.locationtech.jts.operation.buffer.BufferParameters; import org.locationtech.jts.triangulate.VoronoiDiagramBuilder; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.NoSuchAuthorityCodeException; -import org.geotools.api.referencing.crs.CoordinateReferenceSystem; -import org.geotools.api.referencing.operation.MathTransform; -import org.geotools.api.referencing.operation.TransformException; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.NoSuchAuthorityCodeException; +import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.opengis.referencing.operation.MathTransform; +import org.opengis.referencing.operation.TransformException; diff --git a/common/src/main/java/org/apache/sedona/common/raster/GeometryFunctions.java b/common/src/main/java/org/apache/sedona/common/raster/GeometryFunctions.java index ff215776c..a2c91fbd8 100644 --- a/common/src/main/java/org/apache/sedona/common/raster/GeometryFunctions.java +++ b/common/src/main/java/org/apache/sedona/common/raster/GeometryFunctions.java @@ -22,11 +22,11 @@ package org.apache.sedona.common.raster; import org.apache.sedona.common.utils.RasterUtils; import org.geotools.coverage.grid.GridCoordinates2D; import org.geotools.coverage.grid.GridCoverage2D; -import org.geotools.geometry.jts.ReferencedEnvelope; +import org.geotools.geometry.Envelope2D; import org.locationtech.jts.geom.*; import org.locationtech.jts.geom.impl.CoordinateArraySequence; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.operation.TransformException; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.operation.TransformException; import java.awt.geom.Point2D; @@ -118,7 +118,7 @@ public class GeometryFunctions { } public static Geometry envelope(GridCoverage2D raster) throws FactoryException { - ReferencedEnvelope envelope2D = raster.getEnvelope2D(); + Envelope2D envelope2D = raster.getEnvelope2D(); Envelope envelope = new Envelope(envelope2D.getMinX(), envelope2D.getMaxX(), envelope2D.getMinY(), envelope2D.getMaxY()); int srid = RasterAccessors.srid(raster); diff --git a/common/src/main/java/org/apache/sedona/common/raster/PixelFunctionEditors.java b/common/src/main/java/org/apache/sedona/common/raster/PixelFunctionEditors.java index 88afdb867..9e5f8456c 100644 --- a/common/src/main/java/org/apache/sedona/common/raster/PixelFunctionEditors.java +++ b/common/src/main/java/org/apache/sedona/common/raster/PixelFunctionEditors.java @@ -19,13 +19,14 @@ package org.apache.sedona.common.raster; import org.apache.commons.lang3.tuple.Pair; +import org.apache.sedona.common.Functions; import org.apache.sedona.common.utils.RasterUtils; import org.geotools.coverage.grid.GridCoverage2D; -import org.geotools.geometry.Position2D; +import org.geotools.geometry.DirectPosition2D; import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.Geometry; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.operation.TransformException; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.operation.TransformException; import javax.media.jai.RasterFactory; import java.awt.*; @@ -142,7 +143,7 @@ public class PixelFunctionEditors { if (geometryType.equalsIgnoreCase(Geometry.TYPENAME_POINT) || geometryType.equalsIgnoreCase(Geometry.TYPENAME_MULTIPOINT)) { Coordinate[] coordinates = geom.getCoordinates(); for (Coordinate pointCoordinate: coordinates) { - int[] pointLocation = raster.getGridGeometry().worldToGrid(new Position2D(pointCoordinate.x, pointCoordinate.y)).getCoordinateValues(); + int[] pointLocation = raster.getGridGeometry().worldToGrid(new DirectPosition2D(pointCoordinate.x, pointCoordinate.y)).getCoordinateValues(); double[] pixel = rasterCopied.getPixel(pointLocation[0], pointLocation[1], (double[]) null); pixel[band - 1] = rasterizedGeomData.getPixel(0, 0, (double[]) null)[0]; rasterCopied.setPixel(pointLocation[0], pointLocation[1], pixel); diff --git a/common/src/main/java/org/apache/sedona/common/raster/PixelFunctions.java b/common/src/main/java/org/apache/sedona/common/raster/PixelFunctions.java index c6757b638..65d0a040d 100644 --- a/common/src/main/java/org/apache/sedona/common/raster/PixelFunctions.java +++ b/common/src/main/java/org/apache/sedona/common/raster/PixelFunctions.java @@ -23,12 +23,13 @@ import org.apache.sedona.common.Functions; import org.apache.sedona.common.utils.RasterUtils; import org.geotools.coverage.grid.GridCoordinates2D; import org.geotools.coverage.grid.GridCoverage2D; -import org.geotools.geometry.Position2D; +import org.geotools.geometry.DirectPosition2D; import org.geotools.referencing.operation.transform.AffineTransform2D; import org.locationtech.jts.geom.*; -import org.geotools.api.coverage.PointOutsideCoverageException; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.operation.TransformException; +import org.opengis.coverage.PointOutsideCoverageException; +import org.opengis.geometry.DirectPosition; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.operation.TransformException; import java.awt.geom.Point2D; import java.awt.image.Raster; @@ -276,7 +277,7 @@ public class PixelFunctions result.add(null); } else { Point point = ensurePoint(geom); - Point2D.Double directPosition2D = new Point2D.Double(point.getX(), point.getY()); + DirectPosition directPosition2D = new DirectPosition2D(point.getX(), point.getY()); try { rasterGeom.evaluate(directPosition2D, pixelBuffer); double pixel = pixelBuffer[band - 1]; diff --git a/common/src/main/java/org/apache/sedona/common/raster/RasterAccessors.java b/common/src/main/java/org/apache/sedona/common/raster/RasterAccessors.java index 61a9cef0e..4d04bd0a5 100644 --- a/common/src/main/java/org/apache/sedona/common/raster/RasterAccessors.java +++ b/common/src/main/java/org/apache/sedona/common/raster/RasterAccessors.java @@ -27,10 +27,10 @@ import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.GeometryFactory; import org.locationtech.jts.geom.Point; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.ReferenceIdentifier; -import org.geotools.api.referencing.crs.CoordinateReferenceSystem; -import org.geotools.api.referencing.operation.TransformException; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.ReferenceIdentifier; +import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.opengis.referencing.operation.TransformException; import java.awt.geom.Point2D; import java.util.Arrays; diff --git a/common/src/main/java/org/apache/sedona/common/raster/RasterBandAccessors.java b/common/src/main/java/org/apache/sedona/common/raster/RasterBandAccessors.java index 62fa7f0cb..7022a503c 100644 --- a/common/src/main/java/org/apache/sedona/common/raster/RasterBandAccessors.java +++ b/common/src/main/java/org/apache/sedona/common/raster/RasterBandAccessors.java @@ -26,7 +26,7 @@ import org.apache.sedona.common.utils.RasterUtils; import org.geotools.coverage.GridSampleDimension; import org.geotools.coverage.grid.GridCoverage2D; import org.locationtech.jts.geom.Geometry; -import org.geotools.api.referencing.FactoryException; +import org.opengis.referencing.FactoryException; import javax.media.jai.RasterFactory; import java.awt.image.Raster; diff --git a/common/src/main/java/org/apache/sedona/common/raster/RasterBandEditors.java b/common/src/main/java/org/apache/sedona/common/raster/RasterBandEditors.java index 41b159a5d..637c61d8b 100644 --- a/common/src/main/java/org/apache/sedona/common/raster/RasterBandEditors.java +++ b/common/src/main/java/org/apache/sedona/common/raster/RasterBandEditors.java @@ -25,9 +25,9 @@ import org.geotools.coverage.GridSampleDimension; import org.geotools.coverage.grid.GridCoverage2D; import org.geotools.coverage.processing.operation.Crop; import org.locationtech.jts.geom.Geometry; -import org.geotools.api.parameter.ParameterValueGroup; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.operation.TransformException; +import org.opengis.parameter.ParameterValueGroup; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.operation.TransformException; import javax.media.jai.RasterFactory; import java.awt.geom.Point2D; diff --git a/common/src/main/java/org/apache/sedona/common/raster/RasterConstructors.java b/common/src/main/java/org/apache/sedona/common/raster/RasterConstructors.java index 67b3ad812..c7635c70b 100644 --- a/common/src/main/java/org/apache/sedona/common/raster/RasterConstructors.java +++ b/common/src/main/java/org/apache/sedona/common/raster/RasterConstructors.java @@ -27,6 +27,7 @@ import org.geotools.feature.simple.SimpleFeatureBuilder; import org.geotools.feature.simple.SimpleFeatureTypeBuilder; import org.geotools.gce.arcgrid.ArcGridReader; import org.geotools.gce.geotiff.GeoTiffReader; +import org.geotools.geometry.Envelope2D; import org.geotools.geometry.jts.JTS; import org.geotools.geometry.jts.ReferencedEnvelope; import org.geotools.process.vector.VectorToRasterProcess; @@ -35,13 +36,13 @@ import org.geotools.referencing.crs.DefaultEngineeringCRS; import org.geotools.referencing.operation.transform.AffineTransform2D; import org.geotools.util.factory.Hints; import org.locationtech.jts.geom.Geometry; -import org.geotools.api.feature.simple.SimpleFeature; -import org.geotools.api.feature.simple.SimpleFeatureType; -import org.geotools.api.metadata.spatial.PixelOrientation; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.crs.CoordinateReferenceSystem; -import org.geotools.api.referencing.datum.PixelInCell; -import org.geotools.api.referencing.operation.MathTransform; +import org.opengis.feature.simple.SimpleFeature; +import org.opengis.feature.simple.SimpleFeatureType; +import org.opengis.metadata.spatial.PixelOrientation; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.opengis.referencing.datum.PixelInCell; +import org.opengis.referencing.operation.MathTransform; import ucar.nc2.NetcdfFile; import ucar.nc2.NetcdfFiles; @@ -175,25 +176,26 @@ public class RasterConstructors throw new IllegalArgumentException(String.format("SkewY %d of the raster is not zero.", metadata[7])); } - ReferencedEnvelope bound = null; + Envelope2D bound = null; if (useGeometryExtent) { - bound = ReferencedEnvelope.envelope(geom.getEnvelopeInternal(), raster.getCoordinateReferenceSystem2D()); + bound = JTS.getEnvelope2D(geom.getEnvelopeInternal(), raster.getCoordinateReferenceSystem2D()); } else { - bound = ReferencedEnvelope.create(raster.getEnvelope(), raster.getCoordinateReferenceSystem()); + ReferencedEnvelope envelope = ReferencedEnvelope.create(raster.getEnvelope(), raster.getCoordinateReferenceSystem()); + bound = JTS.getEnvelope2D(envelope, raster.getCoordinateReferenceSystem2D()); } double scaleX = Math.abs(metadata[4]), scaleY = Math.abs(metadata[5]); int width = (int) bound.getWidth(), height = (int) bound.getHeight(); if (width == 0 && height == 0) { - bound = ReferencedEnvelope.rect(bound.getCenterX() - scaleX * 0.5, bound.getCenterY() - scaleY * 0.5, scaleX, scaleY, bound.getCoordinateReferenceSystem()); + bound = new Envelope2D(bound.getCoordinateReferenceSystem(), bound.getCenterX() - scaleX * 0.5, bound.getCenterY() - scaleY * 0.5, scaleX, scaleY); width = 1; height = 1; } else if (height == 0) { - bound = ReferencedEnvelope.rect(bound.getCenterX() - scaleX * 0.5, bound.getCenterY() - scaleY * 0.5, width, scaleY, bound.getCoordinateReferenceSystem()); + bound = new Envelope2D(bound.getCoordinateReferenceSystem(), bound.getCenterX() - scaleX * 0.5, bound.getCenterY() - scaleY * 0.5, width, scaleY); height = 1; } else if (width == 0) { - bound = ReferencedEnvelope.rect(bound.getCenterX() - scaleX * 0.5, bound.getCenterY() - scaleY * 0.5, scaleX, height, bound.getCoordinateReferenceSystem()); + bound = new Envelope2D(bound.getCoordinateReferenceSystem(), bound.getCenterX() - scaleX * 0.5, bound.getCenterY() - scaleY * 0.5, scaleX, height); width = 1; } else { // To preserve scale of reference raster diff --git a/common/src/main/java/org/apache/sedona/common/raster/RasterConstructorsForTesting.java b/common/src/main/java/org/apache/sedona/common/raster/RasterConstructorsForTesting.java index 6890ee6db..47667b9b8 100644 --- a/common/src/main/java/org/apache/sedona/common/raster/RasterConstructorsForTesting.java +++ b/common/src/main/java/org/apache/sedona/common/raster/RasterConstructorsForTesting.java @@ -24,9 +24,9 @@ import org.geotools.coverage.grid.GridEnvelope2D; import org.geotools.coverage.grid.GridGeometry2D; import org.geotools.referencing.crs.DefaultEngineeringCRS; import org.geotools.referencing.operation.transform.AffineTransform2D; -import org.geotools.api.referencing.crs.CoordinateReferenceSystem; -import org.geotools.api.referencing.datum.PixelInCell; -import org.geotools.api.referencing.operation.MathTransform; +import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.opengis.referencing.datum.PixelInCell; +import org.opengis.referencing.operation.MathTransform; import javax.media.jai.RasterFactory; import java.awt.Transparency; diff --git a/common/src/main/java/org/apache/sedona/common/raster/RasterEditors.java b/common/src/main/java/org/apache/sedona/common/raster/RasterEditors.java index fa9cefd9c..235ae8cbd 100644 --- a/common/src/main/java/org/apache/sedona/common/raster/RasterEditors.java +++ b/common/src/main/java/org/apache/sedona/common/raster/RasterEditors.java @@ -28,19 +28,19 @@ import org.geotools.coverage.grid.GridCoverageFactory; import org.geotools.coverage.grid.GridEnvelope2D; import org.geotools.coverage.grid.GridGeometry2D; import org.geotools.coverage.processing.Operations; -import org.geotools.geometry.jts.ReferencedEnvelope; +import org.geotools.geometry.Envelope2D; import org.geotools.referencing.crs.DefaultEngineeringCRS; import org.geotools.referencing.operation.transform.AffineTransform2D; import org.locationtech.jts.index.strtree.STRtree; -import org.geotools.api.coverage.grid.GridCoverage; -import org.geotools.api.coverage.grid.GridGeometry; -import org.geotools.api.metadata.spatial.PixelOrientation; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.crs.CoordinateReferenceSystem; -import org.geotools.api.referencing.datum.PixelInCell; -import org.geotools.api.referencing.operation.MathTransform; -import org.geotools.api.referencing.operation.MathTransform2D; -import org.geotools.api.referencing.operation.TransformException; +import org.opengis.coverage.grid.GridCoverage; +import org.opengis.coverage.grid.GridGeometry; +import org.opengis.metadata.spatial.PixelOrientation; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.opengis.referencing.datum.PixelInCell; +import org.opengis.referencing.operation.MathTransform; +import org.opengis.referencing.operation.MathTransform2D; +import org.opengis.referencing.operation.TransformException; import javax.media.jai.Interpolation; import javax.media.jai.RasterFactory; @@ -178,7 +178,7 @@ public class RasterEditors } - ReferencedEnvelope envelope2D = raster.getEnvelope2D(); + Envelope2D envelope2D = raster.getEnvelope2D(); //process scale changes due to changes in widthOrScale and heightOrScale if (!useScale) { newScaleX = (Math.abs(envelope2D.getMaxX() - envelope2D.getMinX())) / newWidth; diff --git a/common/src/main/java/org/apache/sedona/common/raster/RasterOutputs.java b/common/src/main/java/org/apache/sedona/common/raster/RasterOutputs.java index 42333d25c..ed585a015 100644 --- a/common/src/main/java/org/apache/sedona/common/raster/RasterOutputs.java +++ b/common/src/main/java/org/apache/sedona/common/raster/RasterOutputs.java @@ -25,9 +25,9 @@ import org.geotools.gce.arcgrid.ArcGridWriteParams; import org.geotools.gce.arcgrid.ArcGridWriter; import org.geotools.gce.geotiff.GeoTiffWriteParams; import org.geotools.gce.geotiff.GeoTiffWriter; -import org.geotools.api.coverage.grid.GridCoverageWriter; -import org.geotools.api.parameter.GeneralParameterValue; -import org.geotools.api.parameter.ParameterValueGroup; +import org.opengis.coverage.grid.GridCoverageWriter; +import org.opengis.parameter.GeneralParameterValue; +import org.opengis.parameter.ParameterValueGroup; import javax.imageio.ImageIO; import javax.imageio.ImageWriteParam; diff --git a/common/src/main/java/org/apache/sedona/common/raster/RasterPredicates.java b/common/src/main/java/org/apache/sedona/common/raster/RasterPredicates.java index e330475cf..c45db0bb1 100644 --- a/common/src/main/java/org/apache/sedona/common/raster/RasterPredicates.java +++ b/common/src/main/java/org/apache/sedona/common/raster/RasterPredicates.java @@ -30,12 +30,12 @@ import org.geotools.referencing.CRS; import org.geotools.referencing.crs.DefaultEngineeringCRS; import org.geotools.referencing.crs.DefaultGeographicCRS; import org.locationtech.jts.geom.Geometry; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.ReferenceIdentifier; -import org.geotools.api.referencing.crs.CoordinateReferenceSystem; -import org.geotools.api.referencing.crs.GeographicCRS; -import org.geotools.api.referencing.operation.MathTransform; -import org.geotools.api.referencing.operation.TransformException; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.ReferenceIdentifier; +import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.opengis.referencing.crs.GeographicCRS; +import org.opengis.referencing.operation.MathTransform; +import org.opengis.referencing.operation.TransformException; public class RasterPredicates { /** diff --git a/common/src/main/java/org/apache/sedona/common/raster/netcdf/NetCdfReader.java b/common/src/main/java/org/apache/sedona/common/raster/netcdf/NetCdfReader.java index 032aa5193..ad8f42370 100644 --- a/common/src/main/java/org/apache/sedona/common/raster/netcdf/NetCdfReader.java +++ b/common/src/main/java/org/apache/sedona/common/raster/netcdf/NetCdfReader.java @@ -21,8 +21,8 @@ package org.apache.sedona.common.raster.netcdf; import com.google.common.collect.ImmutableList; import org.apache.sedona.common.raster.RasterConstructors; import org.geotools.coverage.grid.GridCoverage2D; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.datum.PixelInCell; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.datum.PixelInCell; import ucar.ma2.Array; import ucar.nc2.*; diff --git a/common/src/main/java/org/apache/sedona/common/raster/serde/CRSSerializer.java b/common/src/main/java/org/apache/sedona/common/raster/serde/CRSSerializer.java index 7e3c9fdfd..9c427e34f 100644 --- a/common/src/main/java/org/apache/sedona/common/raster/serde/CRSSerializer.java +++ b/common/src/main/java/org/apache/sedona/common/raster/serde/CRSSerializer.java @@ -23,8 +23,8 @@ import com.github.benmanes.caffeine.cache.LoadingCache; import org.apache.commons.io.IOUtils; import org.geotools.referencing.CRS; import org.geotools.referencing.wkt.Formattable; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.crs.CoordinateReferenceSystem; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.crs.CoordinateReferenceSystem; import si.uom.NonSI; import si.uom.SI; diff --git a/common/src/main/java/org/apache/sedona/common/raster/serde/Serde.java b/common/src/main/java/org/apache/sedona/common/raster/serde/Serde.java index 7f67708b6..616ded015 100644 --- a/common/src/main/java/org/apache/sedona/common/raster/serde/Serde.java +++ b/common/src/main/java/org/apache/sedona/common/raster/serde/Serde.java @@ -28,7 +28,7 @@ import org.geotools.coverage.grid.GridEnvelope2D; import org.geotools.coverage.grid.GridGeometry2D; import org.geotools.referencing.operation.transform.AffineTransform2D; import org.objenesis.strategy.StdInstantiatorStrategy; -import org.geotools.api.referencing.operation.MathTransform; +import org.opengis.referencing.operation.MathTransform; import javax.media.jai.RenderedImageAdapter; import java.awt.image.RenderedImage; diff --git a/common/src/main/java/org/apache/sedona/common/utils/CachedCRSTransformFinder.java b/common/src/main/java/org/apache/sedona/common/utils/CachedCRSTransformFinder.java index c3305733a..7d0cd1117 100644 --- a/common/src/main/java/org/apache/sedona/common/utils/CachedCRSTransformFinder.java +++ b/common/src/main/java/org/apache/sedona/common/utils/CachedCRSTransformFinder.java @@ -21,9 +21,9 @@ package org.apache.sedona.common.utils; import com.github.benmanes.caffeine.cache.Caffeine; import com.github.benmanes.caffeine.cache.LoadingCache; import org.geotools.referencing.CRS; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.crs.CoordinateReferenceSystem; -import org.geotools.api.referencing.operation.MathTransform; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.opengis.referencing.operation.MathTransform; /** * A utility class for finding CRS transforms. It avoids the expensive equals() call on CRS objects diff --git a/common/src/main/java/org/apache/sedona/common/utils/RasterUtils.java b/common/src/main/java/org/apache/sedona/common/utils/RasterUtils.java index ce6c3b604..7c8fac3b9 100644 --- a/common/src/main/java/org/apache/sedona/common/utils/RasterUtils.java +++ b/common/src/main/java/org/apache/sedona/common/utils/RasterUtils.java @@ -34,19 +34,20 @@ import org.geotools.coverage.grid.GridCoverage2D; import org.geotools.coverage.grid.GridCoverageFactory; import org.geotools.coverage.grid.GridEnvelope2D; import org.geotools.coverage.grid.GridGeometry2D; -import org.geotools.geometry.Position2D; +import org.geotools.geometry.DirectPosition2D; import org.geotools.referencing.crs.DefaultEngineeringCRS; import org.geotools.referencing.operation.transform.AffineTransform2D; import org.geotools.util.ClassChanger; import org.geotools.util.NumberRange; import org.locationtech.jts.geom.Geometry; -import org.geotools.api.coverage.grid.GridEnvelope; -import org.geotools.api.metadata.spatial.PixelOrientation; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.crs.CoordinateReferenceSystem; -import org.geotools.api.referencing.operation.MathTransform; -import org.geotools.api.referencing.operation.TransformException; -import org.geotools.api.util.InternationalString; +import org.opengis.coverage.grid.GridEnvelope; +import org.opengis.geometry.DirectPosition; +import org.opengis.metadata.spatial.PixelOrientation; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.opengis.referencing.operation.MathTransform; +import org.opengis.referencing.operation.TransformException; +import org.opengis.util.InternationalString; import javax.media.jai.RasterFactory; import javax.media.jai.RenderedImageAdapter; @@ -417,9 +418,9 @@ public class RasterUtils { return raster.getGridGeometry().getGridToCRS2D(PixelOrientation.UPPER_LEFT).transform(gridCoordinates2D, null); } public static int[] getGridCoordinatesFromWorld(GridCoverage2D raster, double longitude, double latitude) throws TransformException { - Point2D directPosition2D = new Position2D(raster.getCoordinateReferenceSystem2D(), longitude, latitude); - Point2D worldCoord = raster.getGridGeometry().getCRSToGrid2D(PixelOrientation.UPPER_LEFT).transform(directPosition2D, null); - double[] coords = new double[] {worldCoord.getX(), worldCoord.getY()}; + DirectPosition2D directPosition2D = new DirectPosition2D(raster.getCoordinateReferenceSystem2D(), longitude, latitude); + DirectPosition worldCoord = raster.getGridGeometry().getCRSToGrid2D(PixelOrientation.UPPER_LEFT).transform((DirectPosition) directPosition2D, null); + double[] coords = worldCoord.getCoordinate(); int[] gridCoords = new int[] {(int) Math.floor(coords[0]), (int) Math.floor(coords[1])}; return gridCoords; } diff --git a/common/src/test/java/org/apache/sedona/common/FunctionsTest.java b/common/src/test/java/org/apache/sedona/common/FunctionsTest.java index 1512bb0b4..701a24594 100644 --- a/common/src/test/java/org/apache/sedona/common/FunctionsTest.java +++ b/common/src/test/java/org/apache/sedona/common/FunctionsTest.java @@ -27,8 +27,8 @@ import org.locationtech.jts.geom.*; import org.locationtech.jts.io.ParseException; import org.locationtech.jts.io.WKTReader; import org.locationtech.jts.io.WKTWriter; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.operation.TransformException; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.operation.TransformException; import java.util.*; import java.util.stream.Collectors; diff --git a/common/src/test/java/org/apache/sedona/common/raster/FunctionEditorsTest.java b/common/src/test/java/org/apache/sedona/common/raster/FunctionEditorsTest.java index 0e50749e5..b324e54eb 100644 --- a/common/src/test/java/org/apache/sedona/common/raster/FunctionEditorsTest.java +++ b/common/src/test/java/org/apache/sedona/common/raster/FunctionEditorsTest.java @@ -26,8 +26,8 @@ import org.geotools.coverage.grid.GridCoverage2D; import org.junit.Test; import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.io.ParseException; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.operation.TransformException; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.operation.TransformException; import java.io.IOException; import java.util.Arrays; diff --git a/common/src/test/java/org/apache/sedona/common/raster/FunctionsTest.java b/common/src/test/java/org/apache/sedona/common/raster/FunctionsTest.java index 7327d614f..2bf3d491b 100644 --- a/common/src/test/java/org/apache/sedona/common/raster/FunctionsTest.java +++ b/common/src/test/java/org/apache/sedona/common/raster/FunctionsTest.java @@ -26,8 +26,8 @@ import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.GeometryFactory; import org.locationtech.jts.geom.Point; import org.locationtech.jts.io.ParseException; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.operation.TransformException; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.operation.TransformException; import java.io.IOException; import java.util.ArrayList; diff --git a/common/src/test/java/org/apache/sedona/common/raster/GeometryFunctionsTest.java b/common/src/test/java/org/apache/sedona/common/raster/GeometryFunctionsTest.java index 703050c84..a01fb5a88 100644 --- a/common/src/test/java/org/apache/sedona/common/raster/GeometryFunctionsTest.java +++ b/common/src/test/java/org/apache/sedona/common/raster/GeometryFunctionsTest.java @@ -24,8 +24,8 @@ import org.junit.Test; import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.Envelope; import org.locationtech.jts.geom.Geometry; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.operation.TransformException; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.operation.TransformException; import java.io.IOException; diff --git a/common/src/test/java/org/apache/sedona/common/raster/MapAlgebraTest.java b/common/src/test/java/org/apache/sedona/common/raster/MapAlgebraTest.java index 79acf3af6..7bf17044c 100644 --- a/common/src/test/java/org/apache/sedona/common/raster/MapAlgebraTest.java +++ b/common/src/test/java/org/apache/sedona/common/raster/MapAlgebraTest.java @@ -22,7 +22,7 @@ import org.apache.sedona.common.utils.RasterUtils; import org.geotools.coverage.grid.GridCoverage2D; import org.junit.Assert; import org.junit.Test; -import org.geotools.api.referencing.FactoryException; +import org.opengis.referencing.FactoryException; import java.awt.image.DataBuffer; import java.util.Random; diff --git a/common/src/test/java/org/apache/sedona/common/raster/RasterAccessorsTest.java b/common/src/test/java/org/apache/sedona/common/raster/RasterAccessorsTest.java index 143d1d88a..d8f52fca8 100644 --- a/common/src/test/java/org/apache/sedona/common/raster/RasterAccessorsTest.java +++ b/common/src/test/java/org/apache/sedona/common/raster/RasterAccessorsTest.java @@ -26,8 +26,8 @@ import org.geotools.referencing.CRS; import org.geotools.referencing.operation.transform.AffineTransform2D; import org.junit.Test; import org.locationtech.jts.geom.*; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.operation.TransformException; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.operation.TransformException; import java.io.IOException; diff --git a/common/src/test/java/org/apache/sedona/common/raster/RasterBandAccessorsTest.java b/common/src/test/java/org/apache/sedona/common/raster/RasterBandAccessorsTest.java index 5514ac890..306aed86f 100644 --- a/common/src/test/java/org/apache/sedona/common/raster/RasterBandAccessorsTest.java +++ b/common/src/test/java/org/apache/sedona/common/raster/RasterBandAccessorsTest.java @@ -24,8 +24,8 @@ import org.geotools.coverage.grid.GridCoverage2D; import org.junit.Test; import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.io.ParseException; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.operation.TransformException; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.operation.TransformException; import java.io.IOException; import java.util.Arrays; diff --git a/common/src/test/java/org/apache/sedona/common/raster/RasterBandEditorsTest.java b/common/src/test/java/org/apache/sedona/common/raster/RasterBandEditorsTest.java index d6dc4d85f..394c28689 100644 --- a/common/src/test/java/org/apache/sedona/common/raster/RasterBandEditorsTest.java +++ b/common/src/test/java/org/apache/sedona/common/raster/RasterBandEditorsTest.java @@ -24,8 +24,8 @@ import org.geotools.coverage.grid.GridCoverage2D; import org.junit.Test; import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.io.ParseException; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.operation.TransformException; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.operation.TransformException; import java.io.IOException; import java.text.DecimalFormat; diff --git a/common/src/test/java/org/apache/sedona/common/raster/RasterConstructorsTest.java b/common/src/test/java/org/apache/sedona/common/raster/RasterConstructorsTest.java index 80afd7860..56427f567 100644 --- a/common/src/test/java/org/apache/sedona/common/raster/RasterConstructorsTest.java +++ b/common/src/test/java/org/apache/sedona/common/raster/RasterConstructorsTest.java @@ -16,16 +16,16 @@ package org.apache.sedona.common.raster; import org.apache.commons.lang3.tuple.Pair; import org.apache.sedona.common.Constructors; import org.apache.sedona.common.utils.RasterUtils; -import org.geotools.api.geometry.Position; import org.geotools.coverage.grid.GridCoordinates2D; import org.geotools.coverage.grid.GridCoverage2D; import org.junit.Assert; import org.junit.Test; import org.locationtech.jts.geom.Geometry; -import org.geotools.api.coverage.SampleDimensionType; +import org.opengis.coverage.SampleDimensionType; +import org.opengis.geometry.DirectPosition; import org.locationtech.jts.io.ParseException; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.operation.TransformException; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.operation.TransformException; import java.awt.image.DataBuffer; import java.awt.image.Raster; @@ -415,8 +415,8 @@ public class RasterConstructorsTest // Check that the pixel at the point translates to the same world coordinate as the corresponding // pixel in the grid coverage try { - Position actualWorldCoord = tileRaster.getGridGeometry().gridToWorld(tileGridCoord); - Position expectedWorldCoord = gridCoverage2D.getGridGeometry().gridToWorld(gridCoord); + DirectPosition actualWorldCoord = tileRaster.getGridGeometry().gridToWorld(tileGridCoord); + DirectPosition expectedWorldCoord = gridCoverage2D.getGridGeometry().gridToWorld(gridCoord); Assert.assertEquals(expectedWorldCoord, actualWorldCoord); } catch (TransformException e) { throw new RuntimeException(e); diff --git a/common/src/test/java/org/apache/sedona/common/raster/RasterEditorsTest.java b/common/src/test/java/org/apache/sedona/common/raster/RasterEditorsTest.java index 07af75b28..0b811ba88 100644 --- a/common/src/test/java/org/apache/sedona/common/raster/RasterEditorsTest.java +++ b/common/src/test/java/org/apache/sedona/common/raster/RasterEditorsTest.java @@ -19,20 +19,20 @@ package org.apache.sedona.common.raster; import org.apache.sedona.common.utils.RasterUtils; -import org.geotools.api.geometry.Bounds; -import org.geotools.api.geometry.Position; import org.geotools.coverage.grid.GridCoordinates2D; import org.geotools.coverage.grid.GridCoverage2D; import org.geotools.coverage.grid.GridEnvelope2D; -import org.geotools.geometry.Position2D; +import org.geotools.geometry.DirectPosition2D; import org.geotools.referencing.CRS; import org.geotools.referencing.operation.transform.AffineTransform2D; import org.junit.Assert; import org.junit.Test; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.crs.CoordinateReferenceSystem; -import org.geotools.api.referencing.operation.MathTransform; -import org.geotools.api.referencing.operation.TransformException; +import org.opengis.geometry.DirectPosition; +import org.opengis.geometry.Envelope; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.opengis.referencing.operation.MathTransform; +import org.opengis.referencing.operation.TransformException; import java.awt.image.DataBuffer; import java.io.IOException; @@ -698,8 +698,8 @@ public class RasterEditorsTest extends RasterTestBase { private void verifyReprojectMatchResult(GridCoverage2D source, GridCoverage2D target, GridCoverage2D transformed) throws TransformException, FactoryException { // Check the envelope and CRS - Bounds expectedEnvelope = target.getEnvelope(); - Bounds actualEnvelope = transformed.getEnvelope(); + Envelope expectedEnvelope = target.getEnvelope(); + Envelope actualEnvelope = transformed.getEnvelope(); assertSameEnvelope(expectedEnvelope, actualEnvelope, 1e-6); CoordinateReferenceSystem expectedCrs = target.getCoordinateReferenceSystem(); CoordinateReferenceSystem actualCrs = transformed.getCoordinateReferenceSystem(); @@ -726,11 +726,11 @@ public class RasterEditorsTest extends RasterTestBase { for (double worldY = ipY; worldY > expectedEnvelope.getMinimum(1); worldY += scaleY) { for (double worldX = ipX; worldX < expectedEnvelope.getMaximum(0); worldX += scaleX) { // Fetch the pixel values from the transformed raster - Position worldPos = new Position2D(worldX, worldY); + DirectPosition worldPos = new DirectPosition2D(worldX, worldY); transformed.evaluate(worldPos, values); // Find the corresponding grid coordinates on the source raster - Position srcWorldPos = crsTrans.transform(worldPos, null); + DirectPosition srcWorldPos = crsTrans.transform(worldPos, null); GridCoordinates2D sourceGridPos = source.getGridGeometry().worldToGrid(srcWorldPos); GridEnvelope2D sourceGridRange = source.getGridGeometry().getGridRange2D(); diff --git a/common/src/test/java/org/apache/sedona/common/raster/RasterOutputTest.java b/common/src/test/java/org/apache/sedona/common/raster/RasterOutputTest.java index d75cd7576..dded35ca5 100644 --- a/common/src/test/java/org/apache/sedona/common/raster/RasterOutputTest.java +++ b/common/src/test/java/org/apache/sedona/common/raster/RasterOutputTest.java @@ -21,7 +21,7 @@ package org.apache.sedona.common.raster; import org.apache.sedona.common.utils.RasterUtils; import org.geotools.coverage.grid.GridCoverage2D; import org.junit.Test; -import org.geotools.api.referencing.FactoryException; +import org.opengis.referencing.FactoryException; import javax.imageio.ImageIO; import java.io.File; diff --git a/common/src/test/java/org/apache/sedona/common/raster/RasterPredicatesTest.java b/common/src/test/java/org/apache/sedona/common/raster/RasterPredicatesTest.java index c9c535985..05d9605b9 100644 --- a/common/src/test/java/org/apache/sedona/common/raster/RasterPredicatesTest.java +++ b/common/src/test/java/org/apache/sedona/common/raster/RasterPredicatesTest.java @@ -18,7 +18,6 @@ */ package org.apache.sedona.common.raster; -import org.geotools.api.geometry.BoundingBox; import org.geotools.coverage.grid.GridCoverage2D; import org.geotools.geometry.jts.JTS; import org.geotools.referencing.CRS; @@ -31,9 +30,10 @@ import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.GeometryFactory; import org.locationtech.jts.geom.PrecisionModel; import org.locationtech.jts.io.ParseException; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.crs.CoordinateReferenceSystem; -import org.geotools.api.referencing.operation.TransformException; +import org.opengis.geometry.BoundingBox; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.opengis.referencing.operation.TransformException; import java.awt.image.DataBuffer; import java.io.IOException; diff --git a/common/src/test/java/org/apache/sedona/common/raster/RasterTestBase.java b/common/src/test/java/org/apache/sedona/common/raster/RasterTestBase.java index b2b512f80..d531c77f6 100644 --- a/common/src/test/java/org/apache/sedona/common/raster/RasterTestBase.java +++ b/common/src/test/java/org/apache/sedona/common/raster/RasterTestBase.java @@ -13,25 +13,24 @@ */ package org.apache.sedona.common.raster; - import org.geotools.api.geometry.Bounds; - import org.geotools.api.geometry.Position; import org.geotools.coverage.grid.GridCoordinates2D; import org.geotools.coverage.grid.GridCoverage2D; import org.geotools.coverage.grid.GridCoverageFactory; import org.geotools.gce.geotiff.GeoTiffReader; import org.geotools.gce.geotiff.GeoTiffWriter; - - import org.geotools.geometry.Position2D; - import org.geotools.geometry.jts.ReferencedEnvelope; +import org.geotools.geometry.DirectPosition2D; +import org.geotools.geometry.Envelope2D; +import org.geotools.geometry.jts.ReferencedEnvelope; import org.geotools.referencing.CRS; import org.geotools.referencing.crs.DefaultGeographicCRS; import org.junit.Assert; import org.junit.Before; - -import org.geotools.api.parameter.GeneralParameterValue; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.crs.CoordinateReferenceSystem; -import org.geotools.api.referencing.operation.TransformException; +import org.opengis.geometry.DirectPosition; +import org.opengis.geometry.Envelope; +import org.opengis.parameter.GeneralParameterValue; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.opengis.referencing.operation.TransformException; import javax.media.jai.RasterFactory; import java.awt.*; @@ -119,7 +118,7 @@ public class RasterTestBase { image.setRGB(i, j, new Color(color, color, color).getRGB()); } } - return factory.create("test", image, ReferencedEnvelope.rect(0, 0, 10, 10, DefaultGeographicCRS.WGS84)); + return factory.create("test", image, new Envelope2D(DefaultGeographicCRS.WGS84, 0, 0, 10, 10)); } protected void assertSameCoverage(GridCoverage2D expected, GridCoverage2D actual) { @@ -128,8 +127,8 @@ public class RasterTestBase { protected void assertSameCoverage(GridCoverage2D expected, GridCoverage2D actual, int density) { Assert.assertEquals(expected.getNumSampleDimensions(), actual.getNumSampleDimensions()); - Bounds expectedEnvelope = expected.getEnvelope(); - Bounds actualEnvelope = actual.getEnvelope(); + Envelope expectedEnvelope = expected.getEnvelope(); + Envelope actualEnvelope = actual.getEnvelope(); assertSameEnvelope(expectedEnvelope, actualEnvelope, 1e-6); CoordinateReferenceSystem expectedCrs = expected.getCoordinateReferenceSystem(); CoordinateReferenceSystem actualCrs = actual.getCoordinateReferenceSystem(); @@ -137,7 +136,7 @@ public class RasterTestBase { assertSameValues(expected, actual, density); } - protected void assertSameEnvelope(Bounds expected, Bounds actual, double epsilon) { + protected void assertSameEnvelope(Envelope expected, Envelope actual, double epsilon) { Assert.assertEquals(expected.getMinimum(0), actual.getMinimum(0), epsilon); Assert.assertEquals(expected.getMinimum(1), actual.getMinimum(1), epsilon); Assert.assertEquals(expected.getMaximum(0), actual.getMaximum(0), epsilon); @@ -145,7 +144,7 @@ public class RasterTestBase { } protected void assertSameValues(GridCoverage2D expected, GridCoverage2D actual, int density) { - Bounds expectedEnvelope = expected.getEnvelope(); + Envelope expectedEnvelope = expected.getEnvelope(); double x0 = expectedEnvelope.getMinimum(0); double y0 = expectedEnvelope.getMinimum(1); double xStep = (expectedEnvelope.getMaximum(0) - x0) / density; @@ -157,7 +156,7 @@ public class RasterTestBase { for (int j = 0; j < density; j++) { double x = x0 + j * xStep; double y = y0 + i * yStep; - Position position = new Position2D(x, y); + DirectPosition position = new DirectPosition2D(x, y); try { GridCoordinates2D gridPosition = expected.getGridGeometry().worldToGrid(position); if (Double.isNaN(gridPosition.getX()) || Double.isNaN(gridPosition.getY())) { diff --git a/common/src/test/java/org/apache/sedona/common/raster/serde/CRSSerializerTest.java b/common/src/test/java/org/apache/sedona/common/raster/serde/CRSSerializerTest.java index 8603deea1..bb5399fd0 100644 --- a/common/src/test/java/org/apache/sedona/common/raster/serde/CRSSerializerTest.java +++ b/common/src/test/java/org/apache/sedona/common/raster/serde/CRSSerializerTest.java @@ -21,8 +21,8 @@ package org.apache.sedona.common.raster.serde; import org.geotools.referencing.CRS; import org.junit.Assert; import org.junit.Test; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.crs.CoordinateReferenceSystem; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.crs.CoordinateReferenceSystem; public class CRSSerializerTest { @Test diff --git a/common/src/test/java/org/apache/sedona/common/raster/serde/SerdeTest.java b/common/src/test/java/org/apache/sedona/common/raster/serde/SerdeTest.java index 3535775b7..844c3d34f 100644 --- a/common/src/test/java/org/apache/sedona/common/raster/serde/SerdeTest.java +++ b/common/src/test/java/org/apache/sedona/common/raster/serde/SerdeTest.java @@ -23,7 +23,7 @@ import org.apache.sedona.common.raster.RasterTestBase; import org.geotools.coverage.grid.GridCoverage2D; import org.geotools.gce.geotiff.GeoTiffReader; import org.junit.Test; -import org.geotools.api.referencing.FactoryException; +import org.opengis.referencing.FactoryException; import java.io.File; import java.io.IOException; diff --git a/docs/api/java-api.md b/docs/api/java-api.md index e31fdb607..f8400091d 100644 --- a/docs/api/java-api.md +++ b/docs/api/java-api.md @@ -1,3 +1,3 @@ -Please read [Scaladoc](../scaladoc/spark/) +Please read [Javadoc](../javadoc/spark/) Note: Scala can call Java APIs seamlessly. That means Scala users use the same APIs with Java users diff --git a/docs/api/python-api.md b/docs/api/python-api.md new file mode 100644 index 000000000..4737ccfdf --- /dev/null +++ b/docs/api/python-api.md @@ -0,0 +1 @@ +Will be available soon. diff --git a/docs/api/viz/java-api.md b/docs/api/viz/java-api.md index e31fdb607..217a8f250 100644 --- a/docs/api/viz/java-api.md +++ b/docs/api/viz/java-api.md @@ -1,3 +1,3 @@ -Please read [Scaladoc](../scaladoc/spark/) +Please read [Javadoc](../../javadoc/spark/) Note: Scala can call Java APIs seamlessly. That means Scala users use the same APIs with Java users diff --git a/docs/community/develop.md b/docs/community/develop.md index e5007fdc5..6d48f4b13 100644 --- a/docs/community/develop.md +++ b/docs/community/develop.md @@ -4,7 +4,7 @@ ### IDE -We recommend [Intellij IDEA](https://www.jetbrains.com/idea/) with Scala plugin installed. Please make sure that the IDE has JDK 1.11 set as project default. +We recommend [Intellij IDEA](https://www.jetbrains.com/idea/) with Scala plugin installed. Please make sure that the IDE has JDK 1.8 set as project default. ### Import the project diff --git a/docs/community/release-manager.md b/docs/community/release-manager.md index 88044b21c..1702f2167 100644 --- a/docs/community/release-manager.md +++ b/docs/community/release-manager.md @@ -4,13 +4,13 @@ You only need to perform these steps if this is your first time being a release ## 0. Software requirement -* JDK 11: `brew install openjdk@11` -* Maven 3.X. Your Maven must point to JDK 11 (1.11). Check it by `mvn --version` +* JDK 8: `brew install openjdk@8` +* Maven 3.X. Your Maven must point to JDK 8 (1.8). Check it by `mvn --version` * Git and SVN -If your Maven (`mvn --version`) points to other JDK versions, you must change it to JDK 11. Steps are as follows: +If your Maven (`mvn --version`) points to other JDK versions, you must change it to JDK 8. Steps are as follows: -1. Find all Java installed on your machine: `/usr/libexec/java_home -V`. You should see multiple JDK versions including JDK 11. +1. Find all Java installed on your machine: `/usr/libexec/java_home -V`. You should see multiple JDK versions including JDK 8. 2. Run `whereis mvn` to get the installation location of your Maven. The result is a symlink to the actual location. 3. Open it in the terminal (with `sudo` if needed). It will be like this @@ -19,14 +19,14 @@ If your Maven (`mvn --version`) points to other JDK versions, you must change it JAVA_HOME="${JAVA_HOME:-$(/usr/libexec/java_home)}" exec "/usr/local/Cellar/maven/3.6.3/libexec/bin/mvn" "$@" ``` -4. Change `JAVA_HOME:-$(/usr/libexec/java_home)}` to `JAVA_HOME:-$(/usr/libexec/java_home -v 1.11)}`. The resulting content will be like this: +4. Change `JAVA_HOME:-$(/usr/libexec/java_home)}` to `JAVA_HOME:-$(/usr/libexec/java_home -v 1.8)}`. The resulting content will be like this: ``` #!/bin/bash -JAVA_HOME="${JAVA_HOME:-$(/usr/libexec/java_home -v 1.11)}" exec "/usr/local/Cellar/maven/3.6.3/libexec/bin/mvn" "$@" +JAVA_HOME="${JAVA_HOME:-$(/usr/libexec/java_home -v 1.8)}" exec "/usr/local/Cellar/maven/3.6.3/libexec/bin/mvn" "$@" ``` -5. Run `mvn --version` again. It should now point to JDK 11. +5. Run `mvn --version` again. It should now point to JDK 8. ## 1. Obtain Write Access to Sedona GitHub repo diff --git a/docs/community/vote.md b/docs/community/vote.md index ca1445021..f59eceace 100644 --- a/docs/community/vote.md +++ b/docs/community/vote.md @@ -17,7 +17,7 @@ If you prefer to run the steps on your local machine, please read the steps belo ## Install necessary software 1. GPG: On Mac `brew install gnupg gnupg2`. You can check in a terminal `gpg --version`. -2. JDK 1.11. Your Mac might have many different Java versions installed. You can try to use it but not sure if it can pass. You can check in a terminal `java --version`. +2. JDK 1.8 or 1.11. Your Mac might have many different Java versions installed. You can try to use it but not sure if it can pass. You can check in a terminal `java --version`. 3. Apache Maven 3.3.1+. On Mac `brew install maven`. You can check it in a terminal `mvn -version`. 4. Python3 installed on your machine. MacOS comes with Python3 by default. You can check in a terminal `python3 --version`. diff --git a/docs/setup/cluster.md b/docs/setup/cluster.md index 30d19629b..2f07f6040 100644 --- a/docs/setup/cluster.md +++ b/docs/setup/cluster.md @@ -5,7 +5,7 @@ Download a Spark distribution from [Spark download page](http://spark.apache.org ## Preliminary 1. Set up a password-less SSH on your cluster. Each master-worker pair should have bidirectional password-less SSH. -2. Make sure you have installed JRE 1.11 or later. +2. Make sure you have installed JRE 1.8 or later. 3. Add the list of your workers' IP address in ./conf/slaves 4. Besides the necessary Spark settings, you may need to add the following lines in the Spark configuration files to avoid Sedona memory errors: diff --git a/docs/setup/compile.md b/docs/setup/compile.md index 12ffe4a6a..7d2fd8d96 100644 --- a/docs/setup/compile.md +++ b/docs/setup/compile.md @@ -6,7 +6,7 @@ Sedona Scala/Java code is a project with multiple modules. Each module is a Scala/Java mixed project which is managed by Apache Maven 3. -* Make sure your Linux/Mac machine has Java 1.11, Apache Maven 3.3.1+, and Python3.7+. The compilation of Sedona is not tested on Windows machines. +* Make sure your Linux/Mac machine has Java 1.8, Apache Maven 3.3.1+, and Python3.7+. The compilation of Sedona is not tested on Windows machines. To compile all modules, please make sure you are in the root folder of all modules. Then enter the following command in the terminal: diff --git a/docs/setup/flink/platform.md b/docs/setup/flink/platform.md index 7876092a0..10865c9e8 100644 --- a/docs/setup/flink/platform.md +++ b/docs/setup/flink/platform.md @@ -1,4 +1,4 @@ -Sedona Flink binary releases are compiled by Java 1.11 and Scala 2.12, and tested in the following environments: +Sedona Flink binary releases are compiled by Java 1.8 and Scala 2.12, and tested in the following environments: === "Sedona Scala/Java" diff --git a/docs/setup/platform.md b/docs/setup/platform.md index 4a1d62845..400668eb0 100644 --- a/docs/setup/platform.md +++ b/docs/setup/platform.md @@ -1,4 +1,4 @@ -Sedona binary releases are compiled by Java 1.11 and Scala 2.12/2.13 and tested in the following environments: +Sedona binary releases are compiled by Java 1.8 and Scala 2.11/2.12 and tested in the following environments: !!!warning Support of Spark 2.X and Scala 2.11 was removed in Sedona 1.3.0+ although some parts of the source code might still be compatible. Sedona 1.3.0+ release binary for both Scala 2.12 and 2.13. diff --git a/docs/tutorial/demo.md b/docs/tutorial/demo.md index 14899c12e..a21443184 100644 --- a/docs/tutorial/demo.md +++ b/docs/tutorial/demo.md @@ -18,7 +18,7 @@ The folder structure of this repository is as follows. Please make sure you have the following software installed on your local machine: * For Scala: Scala 2.12 -* For Java: JDK 1.11, Apache Maven 3 +* For Java: JDK 1.8, Apache Maven 3 ### Compile diff --git a/flink/src/main/java/org/apache/sedona/flink/expressions/Functions.java b/flink/src/main/java/org/apache/sedona/flink/expressions/Functions.java index fe34c38ea..013fb7241 100644 --- a/flink/src/main/java/org/apache/sedona/flink/expressions/Functions.java +++ b/flink/src/main/java/org/apache/sedona/flink/expressions/Functions.java @@ -13,6 +13,7 @@ */ package org.apache.sedona.flink.expressions; +import org.apache.calcite.runtime.Geometries; import org.apache.commons.lang3.tuple.Pair; import org.apache.flink.table.annotation.DataTypeHint; import org.apache.flink.table.annotation.InputGroup; @@ -20,6 +21,8 @@ import org.apache.flink.table.functions.ScalarFunction; import org.apache.sedona.common.FunctionsGeoTools; import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.operation.buffer.BufferParameters; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.operation.TransformException; import java.util.Arrays; @@ -69,21 +72,21 @@ public class Functions { public static class ST_Buffer extends ScalarFunction { @DataTypeHint(value = "RAW", bridgedTo = org.locationtech.jts.geom.Geometry.class) public Geometry eval(@DataTypeHint(value = "RAW", bridgedTo = org.locationtech.jts.geom.Geometry.class) - Object o, @DataTypeHint("Double") Double radius) { + Object o, @DataTypeHint("Double") Double radius) throws FactoryException, TransformException { Geometry geom = (Geometry) o; return org.apache.sedona.common.Functions.buffer(geom, radius); } @DataTypeHint(value = "RAW", bridgedTo = org.locationtech.jts.geom.Geometry.class) public Geometry eval(@DataTypeHint(value = "RAW", bridgedTo = org.locationtech.jts.geom.Geometry.class) - Object o, @DataTypeHint("Double") Double radius, @DataTypeHint("Boolean") Boolean useSpheroid) { + Object o, @DataTypeHint("Double") Double radius, @DataTypeHint("Boolean") Boolean useSpheroid) throws FactoryException, TransformException { Geometry geom = (Geometry) o; return org.apache.sedona.common.Functions.buffer(geom, radius, useSpheroid); } @DataTypeHint(value = "RAW", bridgedTo = org.locationtech.jts.geom.Geometry.class) public Geometry eval(@DataTypeHint(value = "RAW", bridgedTo = org.locationtech.jts.geom.Geometry.class) - Object o, @DataTypeHint("Double") Double radius, @DataTypeHint("Boolean") Boolean useSpheroid, @DataTypeHint("String") String params) { + Object o, @DataTypeHint("Double") Double radius, @DataTypeHint("Boolean") Boolean useSpheroid, @DataTypeHint("String") String params) throws FactoryException, TransformException { Geometry geom = (Geometry) o; return org.apache.sedona.common.Functions.buffer(geom, radius, useSpheroid, params); } diff --git a/flink/src/main/java/org/apache/sedona/flink/expressions/FunctionsGeoTools.java b/flink/src/main/java/org/apache/sedona/flink/expressions/FunctionsGeoTools.java index 842ef42eb..65054cf11 100644 --- a/flink/src/main/java/org/apache/sedona/flink/expressions/FunctionsGeoTools.java +++ b/flink/src/main/java/org/apache/sedona/flink/expressions/FunctionsGeoTools.java @@ -15,8 +15,8 @@ package org.apache.sedona.flink.expressions; import org.apache.flink.table.annotation.DataTypeHint; import org.apache.flink.table.functions.ScalarFunction; import org.locationtech.jts.geom.Geometry; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.operation.TransformException; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.operation.TransformException; public class FunctionsGeoTools { diff --git a/flink/src/test/java/org/apache/sedona/flink/FunctionTest.java b/flink/src/test/java/org/apache/sedona/flink/FunctionTest.java index daef6d9b1..0306e5b52 100644 --- a/flink/src/test/java/org/apache/sedona/flink/FunctionTest.java +++ b/flink/src/test/java/org/apache/sedona/flink/FunctionTest.java @@ -27,8 +27,8 @@ import org.junit.Test; import org.locationtech.jts.geom.*; import org.locationtech.jts.io.ParseException; import org.locationtech.jts.operation.buffer.BufferParameters; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.crs.CoordinateReferenceSystem; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.crs.CoordinateReferenceSystem; import scala.collection.immutable.Stream; import java.util.Arrays; diff --git a/mkdocs.yml b/mkdocs.yml index c2f12455a..983bdbb22 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -80,7 +80,7 @@ nav: - Raster affine transformation: api/sql/Raster-affine-transformation.md - Parameter: api/sql/Parameter.md - RDD (core): - - Scala doc: api/java-api.md + - Scala/Java doc: api/java-api.md - Viz: - DataFrame/SQL: api/viz/sql.md - RDD: api/viz/java-api.md diff --git a/pom.xml b/pom.xml index 2da02092d..c0375f0eb 100644 --- a/pom.xml +++ b/pom.xml @@ -68,7 +68,7 @@ <maven.compiler.plugin.version>3.10.1</maven.compiler.plugin.version> <cdm.version>5.4.2</cdm.version> - <geotools.version>31.0</geotools.version> + <geotools.version>28.2</geotools.version> <hadoop.version>3.2.4</hadoop.version> <jackson.version>2.13.4</jackson.version> <jts.version>1.19.0</jts.version> diff --git a/python/tests/sql/test_dataframe_api.py b/python/tests/sql/test_dataframe_api.py index 1c558d2f1..56ec8212a 100644 --- a/python/tests/sql/test_dataframe_api.py +++ b/python/tests/sql/test_dataframe_api.py @@ -87,7 +87,7 @@ test_configurations = [ (stf.ST_BestSRID, ("geom",), "triangle_geom", "", 3395), (stf.ST_Boundary, ("geom",), "triangle_geom", "", "LINESTRING (0 0, 1 0, 1 1, 0 0)"), (stf.ST_Buffer, ("point", 1.0), "point_geom", "ST_ReducePrecision(geom, 2)", "POLYGON ((0.98 0.8, 0.92 0.62, 0.83 0.44, 0.71 0.29, 0.56 0.17, 0.38 0.08, 0.2 0.02, 0 0, -0.2 0.02, -0.38 0.08, -0.56 0.17, -0.71 0.29, -0.83 0.44, -0.92 0.62, -0.98 0.8, -1 1, -0.98 1.2, -0.92 1.38, -0.83 1.56, -0.71 1.71, -0.56 1.83, -0.38 1.92, -0.2 1.98, 0 2, 0.2 1.98, 0.38 1.92, 0.56 1.83, 0.71 1.71, 0.83 1.56, 0.92 1.38, 0.98 1.2, 1 1, 0.98 0.8))"), - (stf.ST_Buffer, ("point", 1.0, True), "point_geom", "ST_Area(geom)", 2.531298835379864e-10), + (stf.ST_Buffer, ("point", 1.0, True), "point_geom", "", "POLYGON ((0.0000089758113634 1.0000000082631704, 0.0000088049473096 0.9999982455016537, 0.0000082957180969 0.9999965501645043, 0.0000074676931201 0.9999949874025787, 0.0000063526929175 0.9999936172719434, 0.0000049935663218 0.9999924924259491, 0.000003442543808 0.9999916560917964, 0.0000017592303026 0.9999911404093366, 0.0000000083146005 0.999990965195956, -0.0000017429165916 0.9999911371850047, -0.0000034271644398 0.9999916497 [...] (stf.ST_BuildArea, ("geom",), "multiline_geom", "ST_Normalize(geom)", "POLYGON ((0 0, 1 1, 1 0, 0 0))"), (stf.ST_BoundingDiagonal, ("geom",), "square_geom", "ST_BoundingDiagonal(geom)", "LINESTRING (1 0, 2 1)"), (stf.ST_Centroid, ("geom",), "triangle_geom", "ST_ReducePrecision(geom, 2)", "POINT (0.67 0.33)"), diff --git a/snowflake/src/main/java/org/apache/sedona/snowflake/snowsql/GeoToolsWrapper.java b/snowflake/src/main/java/org/apache/sedona/snowflake/snowsql/GeoToolsWrapper.java index 9f53fce7b..ef96ab05a 100644 --- a/snowflake/src/main/java/org/apache/sedona/snowflake/snowsql/GeoToolsWrapper.java +++ b/snowflake/src/main/java/org/apache/sedona/snowflake/snowsql/GeoToolsWrapper.java @@ -15,8 +15,8 @@ package org.apache.sedona.snowflake.snowsql; import org.apache.sedona.common.FunctionsGeoTools; import org.locationtech.jts.geom.Geometry; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.operation.TransformException; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.operation.TransformException; public class GeoToolsWrapper { public static Geometry transform(Geometry geometry, String sourceCRS, String targetCRS, boolean lenient) { diff --git a/spark/common/src/main/java/org/apache/sedona/core/spatialOperator/KNNQuery.java b/spark/common/src/main/java/org/apache/sedona/core/spatialOperator/KNNQuery.java index 775c477b0..71bf27756 100644 --- a/spark/common/src/main/java/org/apache/sedona/core/spatialOperator/KNNQuery.java +++ b/spark/common/src/main/java/org/apache/sedona/core/spatialOperator/KNNQuery.java @@ -26,8 +26,8 @@ import org.apache.sedona.core.knnJudgement.KnnJudgementUsingIndex; import org.apache.sedona.core.spatialRDD.SpatialRDD; import org.apache.spark.api.java.JavaRDD; import org.locationtech.jts.geom.Geometry; -import org.geotools.api.referencing.FactoryException; -import org.geotools.api.referencing.operation.TransformException; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.operation.TransformException; import java.io.Serializable; import java.util.List; diff --git a/spark/common/src/main/scala/org/apache/spark/sql/sedona_sql/strategy/join/JoinedGeometryRaster.scala b/spark/common/src/main/scala/org/apache/spark/sql/sedona_sql/strategy/join/JoinedGeometryRaster.scala index 03d6fd617..a3fd7d3c4 100644 --- a/spark/common/src/main/scala/org/apache/spark/sql/sedona_sql/strategy/join/JoinedGeometryRaster.scala +++ b/spark/common/src/main/scala/org/apache/spark/sql/sedona_sql/strategy/join/JoinedGeometryRaster.scala @@ -20,13 +20,14 @@ package org.apache.spark.sql.sedona_sql.strategy.join import org.apache.sedona.common.FunctionsGeoTools import org.apache.sedona.common.utils.{CachedCRSTransformFinder, GeomUtils} -import org.geotools.api.geometry.{BoundingBox, Bounds} import org.geotools.coverage.grid.GridCoverage2D -import org.geotools.geometry.jts.{JTS, ReferencedEnvelope} +import org.geotools.geometry.Envelope2D +import org.geotools.geometry.jts.JTS import org.geotools.referencing.CRS import org.geotools.referencing.crs.{DefaultEngineeringCRS, DefaultGeographicCRS} import org.locationtech.jts.geom.{Envelope, Geometry} -import org.geotools.api.referencing.crs.{CoordinateReferenceSystem, GeographicCRS} +import org.opengis.geometry.BoundingBox +import org.opengis.referencing.crs.{CoordinateReferenceSystem, GeographicCRS} object JoinedGeometryRaster { /** @@ -57,13 +58,13 @@ object JoinedGeometryRaster { geom } else { val env = geom.getEnvelopeInternal - val envelope = ReferencedEnvelope.rect(env.getMinX, env.getMinY, env.getWidth, env.getHeight, null) + val envelope = new Envelope2D(null, env.getMinX, env.getMinY, env.getWidth, env.getHeight) val crs = FunctionsGeoTools.sridToCRS(srid) transformToWGS84Envelope(envelope, crs) } } - private def transformToWGS84Envelope(envelope: Bounds, crs: CoordinateReferenceSystem): Geometry = { + private def transformToWGS84Envelope(envelope: org.opengis.geometry.Envelope, crs: CoordinateReferenceSystem): Geometry = { // We use CRS.transform for envelopes to transform envelopes between different CRSs. This transformation function // could handle envelope crossing the anti-meridian and envelope near or covering poles correctly. We won't have // these cases properly handled if we transform the original geometries using JTS.transform. diff --git a/spark/common/src/test/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/ShapefileRDDTest.java b/spark/common/src/test/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/ShapefileRDDTest.java index 52a626707..2c2d4b7ca 100644 --- a/spark/common/src/test/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/ShapefileRDDTest.java +++ b/spark/common/src/test/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/ShapefileRDDTest.java @@ -29,9 +29,9 @@ import org.apache.sedona.core.spatialRDD.PointRDD; import org.apache.sedona.core.spatialRDD.PolygonRDD; import org.apache.spark.SparkConf; import org.apache.spark.api.java.JavaSparkContext; -import org.geotools.api.data.DataStore; -import org.geotools.api.data.DataStoreFinder; -import org.geotools.api.data.FeatureSource; +import org.geotools.data.DataStore; +import org.geotools.data.DataStoreFinder; +import org.geotools.data.FeatureSource; import org.geotools.data.shapefile.files.ShpFiles; import org.geotools.data.shapefile.shp.ShapefileReader; import org.geotools.feature.FeatureCollection; @@ -44,9 +44,9 @@ import org.locationtech.jts.geom.Envelope; import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.GeometryFactory; import org.locationtech.jts.geom.MultiPolygon; -import org.geotools.api.feature.simple.SimpleFeature; -import org.geotools.api.feature.simple.SimpleFeatureType; -import org.geotools.api.filter.Filter; +import org.opengis.feature.simple.SimpleFeature; +import org.opengis.feature.simple.SimpleFeatureType; +import org.opengis.filter.Filter; import java.io.File; import java.io.IOException; diff --git a/spark/common/src/test/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/ShapefileReaderTest.java b/spark/common/src/test/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/ShapefileReaderTest.java index 545545a03..65d145ed5 100644 --- a/spark/common/src/test/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/ShapefileReaderTest.java +++ b/spark/common/src/test/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/ShapefileReaderTest.java @@ -37,9 +37,9 @@ import org.apache.sedona.core.spatialRDD.PointRDD; import org.apache.sedona.core.spatialRDD.PolygonRDD; import org.apache.sedona.core.spatialRDD.SpatialRDD; import org.apache.spark.SparkException; -import org.geotools.api.data.DataStore; -import org.geotools.api.data.DataStoreFinder; -import org.geotools.api.data.FeatureSource; +import org.geotools.data.DataStore; +import org.geotools.data.DataStoreFinder; +import org.geotools.data.FeatureSource; import org.geotools.data.shapefile.files.ShpFiles; import org.geotools.feature.FeatureCollection; import org.geotools.feature.FeatureIterator; @@ -50,10 +50,10 @@ import org.locationtech.jts.geom.Envelope; import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.GeometryFactory; import org.locationtech.jts.geom.MultiPolygon; -import org.geotools.api.feature.Property; -import org.geotools.api.feature.simple.SimpleFeature; -import org.geotools.api.feature.simple.SimpleFeatureType; -import org.geotools.api.filter.Filter; +import org.opengis.feature.Property; +import org.opengis.feature.simple.SimpleFeature; +import org.opengis.feature.simple.SimpleFeatureType; +import org.opengis.filter.Filter; import java.io.File; import java.io.IOException; diff --git a/spark/common/src/test/scala/org/apache/sedona/sql/functionTestScala.scala b/spark/common/src/test/scala/org/apache/sedona/sql/functionTestScala.scala index f880b0700..3fee1e53c 100644 --- a/spark/common/src/test/scala/org/apache/sedona/sql/functionTestScala.scala +++ b/spark/common/src/test/scala/org/apache/sedona/sql/functionTestScala.scala @@ -32,7 +32,7 @@ import org.locationtech.jts.geom.{Coordinate, Geometry, GeometryFactory, Polygon import org.locationtech.jts.io.WKTWriter import org.locationtech.jts.linearref.LengthIndexedLine import org.locationtech.jts.operation.distance3d.Distance3DOp -import org.geotools.api.referencing.FactoryException +import org.opengis.referencing.FactoryException import org.scalatest.{GivenWhenThen, Matchers} import org.xml.sax.InputSource
