You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sedona.apache.org by ji...@apache.org on 2020/10/18 07:43:04 UTC
[incubator-sedona] branch sedona-release-3.0 updated: Change path
name and add ASF file headers
This is an automated email from the ASF dual-hosted git repository.
jiayu pushed a commit to branch sedona-release-3.0
in repository https://gitbox.apache.org/repos/asf/incubator-sedona.git
The following commit(s) were added to refs/heads/sedona-release-3.0 by this push:
new 33c899c Change path name and add ASF file headers
33c899c is described below
commit 33c899cfd72e4f39d86b1f0bb995058b7a034b36
Author: Jia Yu <ji...@apache.org>
AuthorDate: Sun Oct 18 00:43:41 2020 -0700
Change path name and add ASF file headers
---
core/pom.xml | 50 +-
.../sedona/core}/enums/FileDataSplitter.java | 60 +-
.../org/apache/sedona/core/enums/GeometryType.java | 56 +
.../org/apache/sedona/core/enums/GridType.java | 75 +
.../org/apache/sedona/core/enums/IndexType.java | 56 +
.../apache/sedona/core/enums/JoinBuildSide.java | 41 +
.../core/enums/JoinSparitionDominantSide.java | 35 +
.../formatMapper/EarthdataHDFPointMapper.java | 90 +-
.../sedona/core}/formatMapper/FormatMapper.java | 199 +-
.../sedona/core}/formatMapper/GeoJsonReader.java | 58 +-
.../core/formatMapper/LineStringFormatMapper.java | 53 +
.../core/formatMapper/PointFormatMapper.java | 52 +
.../core/formatMapper/PolygonFormatMapper.java | 53 +
.../apache/sedona/core/formatMapper/RddReader.java | 35 +
.../core/formatMapper/RectangleFormatMapper.java | 52 +
.../sedona/core}/formatMapper/WkbReader.java | 50 +-
.../sedona/core}/formatMapper/WktReader.java | 50 +-
.../formatMapper/shapefileParser/ShapefileRDD.java | 113 +-
.../shapefileParser/ShapefileReader.java | 76 +-
.../shapefileParser/boundary/BoundBox.java | 167 +-
.../boundary/BoundaryInputFormat.java | 29 +-
.../boundary/BoundaryRecordReader.java | 29 +-
.../fieldname/FieldnameInputFormat.java | 29 +-
.../fieldname/FieldnameRecordReader.java | 43 +-
.../parseUtils/dbf/DbfParseUtil.java | 91 +-
.../parseUtils/dbf/FieldDescriptor.java | 29 +-
.../parseUtils/shp/MultiPointParser.java | 33 +-
.../parseUtils/shp/PointParser.java | 29 +-
.../parseUtils/shp/PolyLineParser.java | 33 +-
.../parseUtils/shp/PolygonParser.java | 35 +-
.../parseUtils/shp/ShapeFileConst.java | 89 +
.../parseUtils/shp/ShapeParser.java | 29 +-
.../parseUtils/shp/ShapeReader.java | 32 +
.../parseUtils/shp/ShapeReaderFactory.java | 28 +-
.../shapefileParser/parseUtils/shp/ShapeSerde.java | 43 +-
.../shapefileParser/parseUtils/shp/ShapeType.java | 29 +-
.../parseUtils/shp/ShpFileParser.java | 109 +-
.../parseUtils/shp/TypeUnknownException.java | 40 +
.../shapefileParser/shapes/CombineShapeReader.java | 73 +-
.../shapefileParser/shapes/DbfFileReader.java | 45 +-
.../shapefileParser/shapes/PrimitiveShape.java | 37 +-
.../shapefileParser/shapes/ShapeFileReader.java | 43 +-
.../shapefileParser/shapes/ShapeInputFormat.java | 44 +-
.../shapefileParser/shapes/ShapeKey.java | 50 +
.../shapefileParser/shapes/ShpRecord.java | 62 +
.../sedona/core}/geometryObjects/Circle.java | 58 +-
.../core}/geometryObjects/GeometrySerde.java | 84 +-
.../core}/geometryObjects/SpatialIndexSerde.java | 82 +-
.../sedona/core/joinJudgement/DedupParams.java | 49 +
.../joinJudgement/DynamicIndexLookupJudgement.java | 66 +-
.../sedona/core}/joinJudgement/JudgementBase.java | 37 +-
.../joinJudgement/LeftIndexLookupJudgement.java | 32 +-
.../core}/joinJudgement/NestedLoopJudgement.java | 31 +-
.../joinJudgement/RightIndexLookupJudgement.java | 32 +-
.../knnJudgement/GeometryDistanceComparator.java | 29 +-
.../sedona/core}/knnJudgement/KnnJudgement.java | 33 +-
.../core}/knnJudgement/KnnJudgementUsingIndex.java | 31 +-
.../sedona/core}/rangeJudgement/JudgementBase.java | 39 +-
.../sedona/core/rangeJudgement/RangeFilter.java | 50 +
.../rangeJudgement/RangeFilterUsingIndex.java | 31 +-
.../sedona/core/serde/SedonaKryoRegistrator.java} | 42 +-
.../showcase/EarthdataMapperRunnableExample.java | 47 +-
.../sedona/core}/showcase/Example.java | 67 +-
.../showcase/UserSuppliedLineStringMapper.java | 35 +-
.../core}/showcase/UserSuppliedPointMapper.java | 31 +-
.../core}/showcase/UserSuppliedPolygonMapper.java | 35 +-
.../showcase/UserSuppliedRectangleMapper.java | 36 +-
.../sedona/core}/spatialOperator/JoinQuery.java | 121 +-
.../sedona/core}/spatialOperator/KNNQuery.java | 41 +-
.../sedona/core}/spatialOperator/RangeQuery.java | 39 +-
.../spatialPartitioning/EqualPartitioning.java | 29 +-
.../spatialPartitioning/FlatGridPartitioner.java | 33 +-
.../spatialPartitioning/HilbertPartitioning.java | 85 +-
.../sedona/core}/spatialPartitioning/KDBTree.java | 120 +-
.../spatialPartitioning/KDBTreePartitioner.java | 70 +-
.../spatialPartitioning/QuadtreePartitioning.java | 33 +-
.../spatialPartitioning/RtreePartitioning.java | 29 +-
.../spatialPartitioning/SpatialPartitioner.java | 35 +-
.../spatialPartitioning/VoronoiPartitioning.java | 29 +-
.../spatialPartitioning/quadtree/QuadNode.java | 41 +
.../quadtree/QuadRectangle.java | 31 +-
.../quadtree/QuadTreePartitioner.java | 65 +-
.../quadtree/StandardQuadTree.java | 115 +-
.../sedona/core}/spatialRDD/CircleRDD.java | 35 +-
.../sedona/core}/spatialRDD/LineStringRDD.java | 42 +-
.../sedona/core}/spatialRDD/PointRDD.java | 39 +-
.../sedona/core}/spatialRDD/PolygonRDD.java | 45 +-
.../sedona/core}/spatialRDD/RectangleRDD.java | 40 +-
.../sedona/core}/spatialRDD/SpatialRDD.java | 131 +-
.../sedona/core}/spatialRddTool/IndexBuilder.java | 32 +-
.../core}/spatialRddTool/StatCalculator.java | 32 +-
.../sedona/core}/utils/CRSTransformation.java | 33 +-
.../sedona/core/utils/HalfOpenRectangle.java | 49 +
.../sedona/core}/utils/RDDSampleUtils.java | 33 +-
.../sedona/core/utils/SedonaConf.java} | 63 +-
.../org/apache/sedona/core/utils/TimeUtils.java | 29 +
.../datasyslab/geospark/enums/GeometryType.java | 53 -
.../org/datasyslab/geospark/enums/GridType.java | 72 -
.../org/datasyslab/geospark/enums/IndexType.java | 53 -
.../datasyslab/geospark/enums/JoinBuildSide.java | 38 -
.../geospark/enums/JoinSparitionDominantSide.java | 32 -
.../formatMapper/LineStringFormatMapper.java | 50 -
.../geospark/formatMapper/PointFormatMapper.java | 50 -
.../geospark/formatMapper/PolygonFormatMapper.java | 50 -
.../geospark/formatMapper/RddReader.java | 32 -
.../formatMapper/RectangleFormatMapper.java | 49 -
.../parseUtils/shp/ShapeFileConst.java | 86 -
.../parseUtils/shp/ShapeReader.java | 30 -
.../parseUtils/shp/TypeUnknownException.java | 37 -
.../shapefileParser/shapes/ShapeKey.java | 47 -
.../shapefileParser/shapes/ShpRecord.java | 59 -
.../geospark/joinJudgement/DedupParams.java | 46 -
.../geospark/rangeJudgement/RangeFilter.java | 47 -
.../spatialPartitioning/quadtree/QuadNode.java | 38 -
.../geospark/utils/HalfOpenRectangle.java | 46 -
.../org/datasyslab/geospark/utils/TimeUtils.java | 27 -
.../sedona/core/monitoring/Listener.scala} | 32 +-
.../org/apache/sedona/core/monitoring/Metric.scala | 53 +
.../apache/sedona/core/monitoring/Metrics.scala | 30 +
.../core/python/SerializationException.scala | 24 +
.../core/python/adapters/EnvelopeAdapter.scala | 40 +
.../core/python/adapters/GeomSerializer.scala | 26 +
.../core/python/adapters/GeometryAdapter.scala | 30 +
.../core/python/adapters/JoinParamsAdapter.scala | 31 +
.../core/python/adapters/PythonConverter.scala} | 29 +-
.../adapters/PythonRddToJavaRDDAdapter.scala | 41 +-
.../python/adapters/RawJvmIndexRDDAdapter.scala | 33 +
.../adapters/SpatialObjectLoaderAdapter.scala | 50 +
.../core/python/translation/CircleSerializer.scala | 40 +
.../python/translation/FlatPairRddConverter.scala | 41 +
.../python/translation/GeometryRddConverter.scala | 38 +
.../translation/GeometrySeqToPythonConverter.scala | 35 +
.../python/translation/GeometrySerializer.scala | 39 +
.../translation/HashSetPairRddConverter.scala | 43 +
.../translation/PythonGeometrySerializer.scala | 61 +
.../translation/PythonRDDToJavaConverter.scala | 38 +-
.../translation/PythonRddToJavaRDDConverter.scala | 25 +-
.../python/translation/RDDToPythonConverter.scala | 26 +
.../sedona/core/python/utils/implicits.scala | 64 +
.../ScalaEarthdataMapperRunnableExample.scala | 43 +-
.../sedona/core}/showcase/ScalaExample.scala | 47 +-
.../sedona/core}/showcase/SpatialJoinShp.scala | 56 +-
.../geospark/monitoring/GeoSparkMetric.scala | 51 -
.../geospark/monitoring/GeoSparkMetrics.scala | 28 -
.../geospark/python/SerializationException.scala | 5 -
.../geospark/python/adapters/EnvelopeAdapter.scala | 20 -
.../geospark/python/adapters/GeomSerializer.scala | 7 -
.../geospark/python/adapters/GeometryAdapter.scala | 12 -
.../python/adapters/JoinParamsAdapter.scala | 13 -
.../python/adapters/RawJvmIndexRDDAdapter.scala | 14 -
.../adapters/SpatialObjectLoaderAdapter.scala | 31 -
.../python/translation/CircleSerializer.scala | 21 -
.../python/translation/FlatPairRddConverter.scala | 22 -
.../python/translation/GeometryRddConverter.scala | 19 -
.../translation/GeometrySeqToPythonConverter.scala | 16 -
.../python/translation/GeometrySerializer.scala | 19 -
.../translation/HashSetPairRddConverter.scala | 24 -
.../translation/PythonGeometrySerializer.scala | 41 -
.../python/translation/RDDToPythonConverter.scala | 7 -
.../geospark/python/utils/implicits.scala | 45 -
.../test/java/org/apache/sedona/core/TestBase.java | 45 +
.../core}/formatMapper/GeoJsonReaderTest.java | 61 +-
.../TestReadInvalidSyntaxGeometriesTest.java | 31 +-
.../sedona/core/formatMapper/WkbReadTest.java | 65 +
.../sedona/core/formatMapper/WktReaderTest.java | 66 +
.../shapefileParser/shapes/GeometrySerdeTest.java | 45 +-
.../shapefileParser/shapes/ShapefileRDDTest.java | 60 +-
.../shapes/ShapefileReaderTest.java | 74 +-
.../sedona/core}/geometryObjects/CircleTest.java | 43 +-
.../geometryObjects/SpatialIndexSerdeTest.java | 39 +-
.../sedona/core}/io/EarthdataHDFTest.java | 49 +-
.../JoinQueryCorrectnessChecker.java | 132 +-
.../sedona/core}/spatialOperator/JoinTestBase.java | 65 +-
.../core}/spatialOperator/LineStringJoinTest.java | 51 +-
.../core}/spatialOperator/LineStringKnnTest.java | 51 +-
.../core}/spatialOperator/LineStringRangeTest.java | 49 +-
.../core}/spatialOperator/PointJoinTest.java | 57 +-
.../sedona/core}/spatialOperator/PointKnnTest.java | 53 +-
.../core}/spatialOperator/PointRangeTest.java | 46 +-
.../core}/spatialOperator/PolygonJoinTest.java | 47 +-
.../core}/spatialOperator/PolygonKnnTest.java | 55 +-
.../core}/spatialOperator/PolygonRangeTest.java | 45 +-
.../core}/spatialOperator/RectangleJoinTest.java | 47 +-
.../core}/spatialOperator/RectangleKnnTest.java | 55 +-
.../core}/spatialOperator/RectangleRangeTest.java | 45 +-
.../quadtree/QuadRectangleTest.java | 53 +
.../quadtree/QuadTreePanel.java | 37 +-
.../quadtree/QuadTreePartitioningTest.java | 62 +
.../spatialPartitioning/quadtree/QuadTreeTest.java | 39 +-
.../quadtree/RenderQuadTree.java | 49 +-
.../core}/spatialRDD/BoundaryAggregationTest.java | 41 +-
.../BoundaryAndCountAggregationTest.java | 41 +-
.../sedona/core}/spatialRDD/LineStringRDDTest.java | 92 +-
.../sedona/core}/spatialRDD/PointRDDTest.java | 75 +-
.../sedona/core}/spatialRDD/PolygonRDDTest.java | 115 +-
.../sedona/core}/spatialRDD/RectangleRDDTest.java | 74 +-
.../core}/spatialRDD/SpatialRDDTestBase.java | 56 +-
.../core}/spatialRDD/SpatialRDDWriterTest.java | 87 +-
.../sedona/core}/utils/CRSTransformationTest.java | 81 +-
.../sedona/core}/utils/RDDSampleUtilsTest.java | 37 +-
.../sedona/core}/utils/testGeoJSON.java | 61 +-
.../org/datasyslab/geospark/GeoSparkTestBase.java | 52 -
.../geospark/formatMapper/WkbReadTest.java | 45 -
.../geospark/formatMapper/WktReaderTest.java | 46 -
.../quadtree/QuadRectangleTest.java | 60 -
.../quadtree/QuadTreePartitioningTest.java | 69 -
.../test/resources/babylon.linestring.properties | 19 +
core/src/test/resources/babylon.point.properties | 19 +
core/src/test/resources/babylon.polygon.properties | 19 +
.../test/resources/babylon.rectangle.properties | 19 +
core/src/test/resources/crs.test.properties | 19 +
.../resources/invalidSyntaxGeometriesJson.json | 141 +-
core/src/test/resources/linestring.test.properties | 19 +
core/src/test/resources/point.test.properties | 19 +
core/src/test/resources/polygon.test.properties | 19 +
core/src/test/resources/rectangle.test.properties | 19 +
core/src/test/resources/testContainsId.json | 36 +-
core/src/test/resources/testInvalidPolygon.json | 222 +-
core/src/test/resources/testPolygon.json | 3007 +++++++++++++-------
.../test/resources/testpolygon-no-property.json | 1240 +++++++-
.../testpolygon-with-null-property-value.json | 140 +-
.../sedona/core/monitoring/MetricSuite.scala | 53 +
.../apache/sedona/core/python/GeometrySample.scala | 55 +
.../apache/sedona/core/python/PythonTestSpec.scala | 30 +
.../org/apache/sedona/core/python/SparkUtil.scala | 45 +
.../core}/python/TestToPythonSerialization.scala | 37 +-
.../scala/org/apache/sedona/core/scalaTest.scala | 220 ++
.../geospark/monitoring/GeoSparkMetricSuite.scala | 60 -
.../geospark/python/GeometrySample.scala | 36 -
.../geospark/python/PythonTestSpec.scala | 11 -
.../org/datasyslab/geospark/python/SparkUtil.scala | 26 -
.../scala/org/datasyslab/geospark/scalaTest.scala | 227 --
pom.xml | 153 +-
python/geospark/__init__.py | 17 +
python/geospark/core/SpatialRDD/__init__.py | 17 +
python/geospark/core/SpatialRDD/circle_rdd.py | 17 +
python/geospark/core/SpatialRDD/linestring_rdd.py | 17 +
python/geospark/core/SpatialRDD/point_rdd.py | 17 +
python/geospark/core/SpatialRDD/polygon_rdd.py | 17 +
python/geospark/core/SpatialRDD/rectangle_rdd.py | 17 +
python/geospark/core/SpatialRDD/spatial_rdd.py | 17 +
.../core/SpatialRDD/spatial_rdd_factory.py | 17 +
python/geospark/core/__init__.py | 17 +
python/geospark/core/enums/__init__.py | 17 +
python/geospark/core/enums/file_data_splitter.py | 17 +
python/geospark/core/enums/grid_type.py | 17 +
python/geospark/core/enums/index_type.py | 17 +
python/geospark/core/enums/join_build_side.py | 17 +
python/geospark/core/enums/spatial.py | 17 +
python/geospark/core/formatMapper/__init__.py | 17 +
python/geospark/core/formatMapper/disc_utils.py | 17 +
.../geospark/core/formatMapper/geo_json_reader.py | 17 +
python/geospark/core/formatMapper/geo_reader.py | 17 +
.../core/formatMapper/shapefileParser/__init__.py | 17 +
.../shapefileParser/shape_file_reader.py | 17 +
python/geospark/core/formatMapper/wkb_reader.py | 17 +
python/geospark/core/formatMapper/wkt_reader.py | 17 +
python/geospark/core/geom/__init__.py | 17 +
python/geospark/core/geom/circle.py | 17 +
python/geospark/core/geom/envelope.py | 17 +
python/geospark/core/jvm/__init__.py | 17 +
python/geospark/core/jvm/abstract.py | 17 +
python/geospark/core/jvm/config.py | 17 +
python/geospark/core/jvm/partitioner.py | 17 +
python/geospark/core/jvm/translate.py | 17 +
python/geospark/core/spatialOperator/__init__.py | 17 +
.../geospark/core/spatialOperator/join_params.py | 17 +
python/geospark/core/spatialOperator/join_query.py | 17 +
python/geospark/core/spatialOperator/knn_query.py | 17 +
.../geospark/core/spatialOperator/range_query.py | 17 +
python/geospark/core/utils.py | 17 +
python/geospark/exceptions.py | 17 +
python/geospark/jars/2_3/__init__.py | 17 +
python/geospark/jars/2_4/__init__.py | 17 +
python/geospark/jars/__init__.py | 17 +
python/geospark/register/__init__.py | 17 +
python/geospark/register/geo_registrator.py | 17 +
python/geospark/register/java_libs.py | 17 +
python/geospark/register/uploading.py | 17 +
python/geospark/sql/__init__.py | 17 +
python/geospark/sql/exceptions.py | 17 +
python/geospark/sql/types.py | 19 +-
python/geospark/utils/__init__.py | 17 +
python/geospark/utils/abstract_parser.py | 17 +
python/geospark/utils/adapter.py | 17 +
python/geospark/utils/binary_parser.py | 17 +
python/geospark/utils/decorators.py | 17 +
python/geospark/utils/geometry_adapter.py | 17 +
python/geospark/utils/jvm.py | 17 +
python/geospark/utils/meta.py | 17 +
python/geospark/utils/prep.py | 17 +
python/geospark/utils/serde.py | 17 +
python/geospark/utils/spatial_rdd_parser.py | 17 +
python/geospark/utils/types.py | 17 +
python/geospark/version.py | 17 +
python/tests/__init__.py | 17 +
python/tests/core/__init__.py | 17 +
python/tests/core/test_core_geom_primitives.py | 17 +
python/tests/core/test_core_rdd.py | 17 +
python/tests/core/test_core_spatial_relations.py | 17 +
python/tests/core/test_rdd.py | 17 +
python/tests/core/test_spatial_rdd_from_disc.py | 17 +
python/tests/data/__init__.py | 17 +
python/tests/data/babylon.linestring.properties | 19 +
python/tests/data/babylon.point.properties | 19 +
python/tests/data/babylon.polygon.properties | 19 +
python/tests/data/babylon.rectangle.properties | 19 +
python/tests/data/crs.test.properties | 19 +
python/tests/data/linestring.test.properties | 19 +
python/tests/data/point.test.properties | 19 +
python/tests/data/polygon.test.properties | 19 +
python/tests/data/rectangle.test.properties | 19 +
python/tests/data/scalastyle_config.xml | 19 +
python/tests/format_mapper/__init__.py | 17 +
python/tests/format_mapper/test_geo_json_reader.py | 17 +
.../tests/format_mapper/test_shapefile_reader.py | 17 +
python/tests/format_mapper/test_wkb_reader.py | 17 +
python/tests/format_mapper/test_wkt_reader.py | 17 +
python/tests/properties/__init__.py | 17 +
python/tests/properties/crs_transform.py | 17 +
python/tests/properties/linestring_properties.py | 17 +
python/tests/properties/point_properties.py | 17 +
python/tests/properties/polygon_properties.py | 17 +
.../tests/resources/babylon.linestring.properties | 19 +
python/tests/resources/babylon.point.properties | 19 +
python/tests/resources/babylon.polygon.properties | 19 +
.../tests/resources/babylon.rectangle.properties | 19 +
python/tests/resources/crs.test.properties | 19 +
python/tests/resources/linestring.test.properties | 19 +
python/tests/resources/point.test.properties | 19 +
python/tests/resources/polygon.test.properties | 19 +
python/tests/resources/rectangle.test.properties | 19 +
python/tests/serialization/__init__.py | 17 +
python/tests/serialization/test_deserializers.py | 17 +
.../serialization/test_direct_serialization.py | 17 +
.../serialization/test_geospark_serializers.py | 17 +
.../tests/serialization/test_rdd_serialization.py | 17 +
python/tests/serialization/test_serializers.py | 17 +
.../tests/serialization/test_with_sc_parellize.py | 17 +
python/tests/spatial_operator/__init__.py | 17 +
python/tests/spatial_operator/test_join_base.py | 17 +
.../test_join_query_correctness.py | 17 +
.../tests/spatial_operator/test_linestring_join.py | 17 +
.../tests/spatial_operator/test_linestring_knn.py | 17 +
.../spatial_operator/test_linestring_range.py | 17 +
python/tests/spatial_operator/test_point_join.py | 17 +
python/tests/spatial_operator/test_point_knn.py | 17 +
python/tests/spatial_operator/test_point_range.py | 17 +
python/tests/spatial_operator/test_polygon_join.py | 17 +
python/tests/spatial_operator/test_polygon_knn.py | 17 +
.../tests/spatial_operator/test_polygon_range.py | 17 +
.../tests/spatial_operator/test_rectangle_join.py | 17 +
.../tests/spatial_operator/test_rectangle_knn.py | 17 +
.../tests/spatial_operator/test_rectangle_range.py | 17 +
python/tests/spatial_rdd/__init__.py | 17 +
python/tests/spatial_rdd/test_circle_rdd.py | 17 +
python/tests/spatial_rdd/test_linestring_rdd.py | 17 +
python/tests/spatial_rdd/test_point_rdd.py | 17 +
python/tests/spatial_rdd/test_polygon_rdd.py | 17 +
python/tests/spatial_rdd/test_rectangle_rdd.py | 17 +
python/tests/spatial_rdd/test_spatial_rdd.py | 17 +
.../tests/spatial_rdd/test_spatial_rdd_writer.py | 17 +
python/tests/sql/__init__.py | 17 +
python/tests/sql/resource/__init__.py | 17 +
python/tests/sql/resource/sample_data.py | 17 +
python/tests/sql/test_adapter.py | 17 +
python/tests/sql/test_aggregate_functions.py | 17 +
python/tests/sql/test_constructor_test.py | 17 +
python/tests/sql/test_function.py | 17 +
python/tests/sql/test_predicate.py | 17 +
python/tests/sql/test_predicate_join.py | 17 +
.../sql/test_spatial_rdd_to_spatial_dataframe.py | 17 +
python/tests/test_assign_raw_spatial_rdd.py | 17 +
python/tests/test_base.py | 17 +
python/tests/test_circle.py | 17 +
python/tests/test_multiple_meta.py | 17 +
python/tests/test_scala_example.py | 17 +
python/tests/tools.py | 17 +
python/tests/utils/__init__.py | 17 +
python/tests/utils/test_crs_transformation.py | 17 +
python/tests/utils/test_geo_spark_meta.py | 17 +
sql/pom.xml | 42 +-
.../sedona/sql}/UDF/Catalog.scala | 38 +-
.../org/apache/sedona/sql/UDF/UdfRegistrator.scala | 39 +
.../org/apache/sedona/sql/UDT/UdtRegistrator.scala | 29 +
.../sedona/sql}/utils/Adapter.scala | 215 +-
.../sedona/sql/utils/GeometrySerializer.scala | 51 +
.../apache/sedona/sql/utils/IndexSerializer.scala | 48 +
.../sedona/sql/utils/PythonAdapterWrapper.scala | 40 +
.../sedona/sql/utils/SedonaSQLRegistrator.scala | 42 +
.../spark/sql/geosparksql/UDT/GeometryUDT.scala | 43 -
.../spark/sql/geosparksql/UDT/IndexUDT.scala | 40 -
.../geosparksql/UDT/UdtRegistratorWrapper.scala | 28 -
.../spark/sql/sedona_sql/UDT/GeometryUDT.scala | 46 +
.../apache/spark/sql/sedona_sql/UDT/IndexUDT.scala | 42 +
.../sql/sedona_sql/UDT/UdtRegistratorWrapper.scala | 30 +
.../expressions/AggregateFunctions.scala | 92 +-
.../expressions/Constructors.scala | 62 +-
.../expressions/Functions.scala | 157 +-
.../expressions/Predicates.scala | 31 +-
.../expressions/implicits.scala | 37 +-
.../strategy/join/DistanceJoinExec.scala | 36 +-
.../strategy/join/JoinQueryDetector.scala | 79 +-
.../strategy/join/RangeJoinExec.scala | 28 +-
.../strategy/join/TraitJoinQueryExec.scala | 148 +-
.../geosparksql/UDF/UdfRegistrator.scala | 37 -
.../geosparksql/UDT/UdtRegistrator.scala | 27 -
.../geosparksql/utils/GeoSparkSQLRegistrator.scala | 40 -
.../geosparksql/utils/GeometrySerializer.scala | 48 -
.../geosparksql/utils/IndexSerializer.scala | 46 -
.../geosparksql/utils/PythonAdapterWrapper.scala | 21 -
.../sedona/sql}/adapterTestJava.java | 86 +-
.../test/resources/babylon.linestring.properties | 19 +
sql/src/test/resources/babylon.point.properties | 19 +
sql/src/test/resources/babylon.polygon.properties | 19 +
.../test/resources/babylon.rectangle.properties | 19 +
sql/src/test/resources/crs.test.properties | 19 +
sql/src/test/resources/linestring.test.properties | 19 +
sql/src/test/resources/point.test.properties | 19 +
sql/src/test/resources/polygon.test.properties | 19 +
sql/src/test/resources/rectangle.test.properties | 19 +
sql/src/test/resources/scalastyle_config.xml | 361 +--
sql/src/test/resources/testContainsId.json | 36 +-
sql/src/test/resources/testPolygon.json | 3007 +++++++++++++-------
.../sedona/sql}/GeometrySample.scala | 60 +-
.../sedona/sql}/TestBaseScala.scala | 62 +-
.../sedona/sql}/adapterTestScala.scala | 71 +-
.../sedona/sql}/aggregateFunctionTestScala.scala | 39 +-
.../sedona/sql}/constructorTestScala.scala | 57 +-
.../sedona/sql}/functionTestScala.scala | 138 +-
.../scala/org/apache/sedona/sql/implicits.scala | 46 +
.../sedona/sql}/predicateJoinTestScala.scala | 49 +-
.../sedona/sql}/predicateTestScala.scala | 39 +-
.../org/datasyslab/geosparksql/implicits.scala | 25 -
viz/pom.xml | 46 +-
.../sedona/viz}/core/BigBufferedImage.java | 109 +-
.../org/apache/sedona/viz/core/ColoringRule.java | 42 +
.../sedona/viz}/core/GlobalParameter.java | 371 +--
.../sedona/viz}/core/ImageGenerator.java | 82 +-
.../sedona/viz}/core/ImageSerializableWrapper.java | 28 +-
.../sedona/viz}/core/ImageStitcher.java | 58 +-
.../sedona/viz}/core/PhotoFilter.java | 28 +-
.../sedona/viz}/core/RasterOverlayOperator.java | 43 +-
.../viz}/core/Serde/ImageWrapperSerializer.java | 33 +-
.../sedona/viz}/core/Serde/PixelSerializer.java | 34 +-
.../viz/core/Serde/SedonaVizKryoRegistrator.java | 44 +
.../sedona/viz}/core/VectorOverlayOperator.java | 52 +-
.../sedona/viz}/core/VisualizationOperator.java | 212 +-
.../sedona/viz}/core/VisualizationPartitioner.java | 129 +-
.../coloringRule/ColoringRuleFactory.java | 56 +
.../coloringRule/GenericColoringRule.java | 59 +
.../viz/extension/coloringRule/LinearFunction.java | 62 +
.../extension/coloringRule/PiecewiseFunction.java | 73 +
.../imageGenerator/SedonaVizImageGenerator.java} | 108 +-
.../sedona/viz/extension/photoFilter/BoxBlur.java | 46 +
.../sedona/viz/extension/photoFilter/Embose.java | 48 +
.../viz}/extension/photoFilter/GaussianBlur.java | 30 +-
.../sedona/viz/extension/photoFilter/Outline.java | 48 +
.../sedona/viz/extension/photoFilter/Sharpen.java | 48 +
.../visualizationEffect/ChoroplethMap.java | 42 +-
.../extension/visualizationEffect/HeatMap.java | 44 +-
.../extension/visualizationEffect/ScatterPlot.java | 40 +-
.../sedona/viz}/showcase/Example.java | 87 +-
.../sedona/viz}/showcase/nycheatmap.png | Bin
.../sedona/viz}/showcase/usrail.png | Bin
.../sedona/viz}/showcase/ustweet.png | Bin
.../sedona/viz}/utils/ColorizeOption.java | 30 +-
.../sedona/viz}/utils/ImageType.java | 30 +-
.../sedona/viz}/utils/Pixel.java | 41 +-
.../sedona/viz}/utils/RasterizationUtils.java | 30 +-
.../sedona/viz}/utils/S3Operator.java | 43 +-
.../datasyslab/geosparkviz/core/ColoringRule.java | 38 -
.../core/Serde/GeoSparkVizKryoRegistrator.java | 42 -
.../coloringRule/ColoringRuleFactory.java | 54 -
.../coloringRule/GenericColoringRule.java | 63 -
.../extension/coloringRule/LinearFunction.java | 62 -
.../extension/coloringRule/PiecewiseFunction.java | 77 -
.../geosparkviz/extension/photoFilter/BoxBlur.java | 44 -
.../geosparkviz/extension/photoFilter/Embose.java | 46 -
.../geosparkviz/extension/photoFilter/Outline.java | 46 -
.../geosparkviz/extension/photoFilter/Sharpen.java | 46 -
.../sedona/viz}/showcase/ScalaExample.scala | 60 +-
.../org/apache/sedona/viz/sql/UDF/Catalog.scala | 37 +
.../apache/sedona/viz/sql/UDF/UdfRegistrator.scala | 39 +
.../apache/sedona/viz/sql/UDT/UdtRegistrator.scala | 29 +
.../sql/operator/AggregateWithinPartitons.scala | 87 +
.../sedona/viz}/sql/operator/VizPartitioner.scala | 55 +-
.../org/apache/sedona/viz/sql/utils/Conf.scala | 24 +
.../sedona/viz/sql/utils/LineageDecoder.scala | 45 +
.../viz/sql/utils/SedonaVizRegistrator.scala | 39 +
.../sql/geosparkviz/UDT/ImageWrapperUDT.scala | 46 -
.../spark/sql/geosparkviz/UDT/PixelUDT.scala | 59 -
.../geosparkviz/UDT/UdtRegistratorWrapper.scala | 29 -
.../spark/sql/sedona_viz/UDT/ImageWrapperUDT.scala | 45 +
.../apache/spark/sql/sedona_viz/UDT/PixelUDT.scala | 58 +
.../sql/sedona_viz/UDT/UdtRegistratorWrapper.scala | 30 +
.../expressions/Colorize.scala | 40 +-
.../expressions/ImageEncoder.scala | 32 +-
.../expressions/Partitioner.scala | 34 +-
.../expressions/Pixelize.scala | 87 +-
.../expressions/Render.scala | 142 +-
.../datasyslab/geosparkviz/sql/UDF/Catalog.scala | 35 -
.../geosparkviz/sql/UDF/UdfRegistrator.scala | 37 -
.../geosparkviz/sql/UDT/UdtRegistrator.scala | 28 -
.../sql/operator/AggregateWithinPartitons.scala | 85 -
.../datasyslab/geosparkviz/sql/utils/Conf.scala | 22 -
.../sql/utils/GeoSparkVizRegistrator.scala | 37 -
.../geosparkviz/sql/utils/LineageDecoder.scala | 43 -
.../sedona/viz}/ChoroplethmapTest.java | 68 +-
.../sedona/viz}/HeatmapTest.java | 57 +-
.../sedona/viz}/NYCTripPointMapper.java | 39 +-
.../sedona/viz}/NYCTripTest.java | 67 +-
.../sedona/viz}/ParallelVisualizationTest.java | 59 +-
.../sedona/viz}/ScatterplotTest.java | 63 +-
.../sedona/viz/SedonaVizTestBase.java} | 66 +-
.../test/resources/babylon.linestring.properties | 19 +
viz/src/test/resources/babylon.point.properties | 19 +
viz/src/test/resources/babylon.polygon.properties | 19 +
.../test/resources/babylon.rectangle.properties | 19 +
viz/src/test/resources/linestring.test.properties | 19 +
viz/src/test/resources/point.test.properties | 19 +
viz/src/test/resources/polygon.test.properties | 19 +
viz/src/test/resources/rectangle.test.properties | 19 +
viz/src/test/resources/scalastyle_config.xml | 361 +--
.../sedona/viz}/rdd/scalaTest.scala | 83 +-
.../org/apache/sedona/viz/sql/TestBaseScala.scala | 54 +
.../sedona/viz}/sql/optVizOperatorTest.scala | 37 +-
.../sedona/viz}/sql/standardVizOperatorTest.scala | 37 +-
.../datasyslab/geosparkviz/sql/TestBaseScala.scala | 61 -
zeppelin/.gitignore | 2 +-
zeppelin/LICENSE | 2 +-
zeppelin/index.js | 4 +-
zeppelin/package.json | 18 +-
533 files changed, 18560 insertions(+), 11193 deletions(-)
diff --git a/core/pom.xml b/core/pom.xml
index 13bc064..cf500d1 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -1,35 +1,37 @@
<!--
- ~ FILE: pom.xml
- ~ Copyright (c) 2015 - 2019 GeoSpark Development Team
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
+ ~ http://www.apache.org/licenses/LICENSE-2.0
~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.datasyslab</groupId>
- <artifactId>geospark-parent</artifactId>
- <version>1.3.2-SNAPSHOT</version>
+ <groupId>org.apache.sedona</groupId>
+ <artifactId>sedona-parent</artifactId>
+ <version>1.0.0-incubator-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <artifactId>geospark</artifactId>
+ <artifactId>core</artifactId>
- <name>${project.groupId}:${project.artifactId}</name>
- <description>Geospatial extension for Apache Spark</description>
- <url>http://geospark.datasyslab.org/</url>
- <packaging>jar</packaging>
+ <name>${project.groupId}:${project.artifactId}</name>
+ <description>A cluster computing system for processing large-scale spatial data: RDD API</description>
+ <url>http://sedona.apache.org/</url>
+ <packaging>jar</packaging>
<dependencies>
<dependency>
@@ -134,7 +136,7 @@
<artifactId>hadoop-minicluster</artifactId>
<version>2.8.2</version>
<scope>test</scope>
- <exclusions>
+ <exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>*</artifactId>
diff --git a/core/src/main/java/org/datasyslab/geospark/enums/FileDataSplitter.java b/core/src/main/java/org/apache/sedona/core/enums/FileDataSplitter.java
similarity index 61%
rename from core/src/main/java/org/datasyslab/geospark/enums/FileDataSplitter.java
rename to core/src/main/java/org/apache/sedona/core/enums/FileDataSplitter.java
index 972e14f..06f0438 100755
--- a/core/src/main/java/org/datasyslab/geospark/enums/FileDataSplitter.java
+++ b/core/src/main/java/org/apache/sedona/core/enums/FileDataSplitter.java
@@ -1,21 +1,23 @@
/*
- * FILE: FileDataSplitter
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.enums;
+package org.apache.sedona.core.enums;
import java.io.Serializable;
@@ -59,7 +61,7 @@ public enum FileDataSplitter
QUESTIONMARK("?"),
- SINGLEQUOTE("\'"),
+ SINGLEQUOTE("'"),
QUOTE("\""),
@@ -76,6 +78,21 @@ public enum FileDataSplitter
SEMICOLON(";");
/**
+ * The splitter.
+ */
+ private final String splitter;
+
+ /**
+ * Instantiates a new file data splitter.
+ *
+ * @param splitter the splitter
+ */
+ FileDataSplitter(String splitter)
+ {
+ this.splitter = splitter;
+ }
+
+ /**
* Gets the file data splitter.
*
* @param str the str
@@ -90,21 +107,6 @@ public enum FileDataSplitter
}
/**
- * The splitter.
- */
- private String splitter;
-
- /**
- * Instantiates a new file data splitter.
- *
- * @param splitter the splitter
- */
- private FileDataSplitter(String splitter)
- {
- this.splitter = splitter;
- }
-
- /**
* Gets the delimiter.
*
* @return the delimiter
diff --git a/core/src/main/java/org/apache/sedona/core/enums/GeometryType.java b/core/src/main/java/org/apache/sedona/core/enums/GeometryType.java
new file mode 100755
index 0000000..20d0152
--- /dev/null
+++ b/core/src/main/java/org/apache/sedona/core/enums/GeometryType.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.enums;
+
+import java.io.Serializable;
+
+// TODO: Auto-generated Javadoc
+
+/**
+ * The Enum GeometryType.
+ */
+public enum GeometryType
+ implements Serializable
+{
+
+ POINT,
+ POLYGON,
+ LINESTRING,
+ MULTIPOINT,
+ MULTIPOLYGON,
+ MULTILINESTRING,
+ GEOMETRYCOLLECTION,
+ CIRCLE,
+ RECTANGLE;
+
+ /**
+ * Gets the GeometryType.
+ *
+ * @param str the str
+ * @return the GeometryType
+ */
+ public static GeometryType getGeometryType(String str)
+ {
+ for (GeometryType me : GeometryType.values()) {
+ if (me.name().equalsIgnoreCase(str)) { return me; }
+ }
+ throw new IllegalArgumentException("[" + GeometryType.class + "] Unsupported geometry type:" + str);
+ }
+}
diff --git a/core/src/main/java/org/apache/sedona/core/enums/GridType.java b/core/src/main/java/org/apache/sedona/core/enums/GridType.java
new file mode 100755
index 0000000..9efdced
--- /dev/null
+++ b/core/src/main/java/org/apache/sedona/core/enums/GridType.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.enums;
+
+import java.io.Serializable;
+
+// TODO: Auto-generated Javadoc
+
+/**
+ * The Enum GridType.
+ */
+public enum GridType
+ implements Serializable
+{
+
+ /**
+ * The equalgrid.
+ */
+ EQUALGRID,
+
+ /**
+ * The hilbert.
+ */
+ HILBERT,
+
+ /**
+ * The rtree.
+ */
+ RTREE,
+
+ /**
+ * The voronoi.
+ */
+ VORONOI,
+ /**
+ * The voronoi.
+ */
+ QUADTREE,
+
+ /**
+ * K-D-B-tree (k-dimensional B-tree)
+ */
+ KDBTREE;
+
+ /**
+ * Gets the grid type.
+ *
+ * @param str the str
+ * @return the grid type
+ */
+ public static GridType getGridType(String str)
+ {
+ for (GridType me : GridType.values()) {
+ if (me.name().equalsIgnoreCase(str)) { return me; }
+ }
+ return null;
+ }
+}
diff --git a/core/src/main/java/org/apache/sedona/core/enums/IndexType.java b/core/src/main/java/org/apache/sedona/core/enums/IndexType.java
new file mode 100755
index 0000000..7a5f220
--- /dev/null
+++ b/core/src/main/java/org/apache/sedona/core/enums/IndexType.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.enums;
+
+import java.io.Serializable;
+
+// TODO: Auto-generated Javadoc
+
+/**
+ * The Enum IndexType.
+ */
+public enum IndexType
+ implements Serializable
+{
+
+ /**
+ * The quadtree.
+ */
+ QUADTREE,
+
+ /**
+ * The rtree.
+ */
+ RTREE;
+
+ /**
+ * Gets the index type.
+ *
+ * @param str the str
+ * @return the index type
+ */
+ public static IndexType getIndexType(String str)
+ {
+ for (IndexType me : IndexType.values()) {
+ if (me.name().equalsIgnoreCase(str)) { return me; }
+ }
+ return null;
+ }
+}
diff --git a/core/src/main/java/org/apache/sedona/core/enums/JoinBuildSide.java b/core/src/main/java/org/apache/sedona/core/enums/JoinBuildSide.java
new file mode 100644
index 0000000..c73b76d
--- /dev/null
+++ b/core/src/main/java/org/apache/sedona/core/enums/JoinBuildSide.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.enums;
+
+import java.io.Serializable;
+
+/**
+ * The enumerator type of JoinQuery JoinBuildSide. Each join query has two sides, left shape and right shape.
+ * The join side desides which side the spatial index is built on. The other side will be streamed out.
+ */
+public enum JoinBuildSide
+ implements Serializable
+{
+ LEFT,
+ RIGHT;
+
+ public static JoinBuildSide getBuildSide(String str)
+ {
+ for (JoinBuildSide me : JoinBuildSide.values()) {
+ if (me.name().equalsIgnoreCase(str)) { return me; }
+ }
+ return null;
+ }
+}
diff --git a/core/src/main/java/org/apache/sedona/core/enums/JoinSparitionDominantSide.java b/core/src/main/java/org/apache/sedona/core/enums/JoinSparitionDominantSide.java
new file mode 100644
index 0000000..8a661af
--- /dev/null
+++ b/core/src/main/java/org/apache/sedona/core/enums/JoinSparitionDominantSide.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.enums;
+
+public enum JoinSparitionDominantSide
+{
+ LEFT,
+ RIGHT,
+ NONE;
+
+ public static JoinSparitionDominantSide getJoinSparitionDominantSide(String str)
+ {
+ for (JoinSparitionDominantSide me : JoinSparitionDominantSide.values()) {
+ if (me.name().equalsIgnoreCase(str)) { return me; }
+ }
+ return null;
+ }
+}
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/EarthdataHDFPointMapper.java b/core/src/main/java/org/apache/sedona/core/formatMapper/EarthdataHDFPointMapper.java
similarity index 89%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/EarthdataHDFPointMapper.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/EarthdataHDFPointMapper.java
index 5989cf1..c228199 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/EarthdataHDFPointMapper.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/EarthdataHDFPointMapper.java
@@ -1,27 +1,30 @@
/*
- * FILE: EarthdataHDFPointMapper
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper;
+package org.apache.sedona.core.formatMapper;
+
+import org.apache.spark.api.java.function.FlatMapFunction;
+import org.datasyslab.sernetcdf.SerNetCDFUtils;
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.apache.spark.api.java.function.FlatMapFunction;
-import org.datasyslab.sernetcdf.SerNetCDFUtils;
import ucar.ma2.Array;
import ucar.nc2.dataset.NetcdfDataset;
@@ -39,70 +42,57 @@ public class EarthdataHDFPointMapper
{
/**
- * The offset.
+ * The geolocation field.
*/
- private int offset = 0;
-
+ private final String geolocationField = "Geolocation_Fields";
/**
- * The increment.
+ * The longitude name.
*/
- private int increment = 1;
-
+ private final String longitudeName = "Longitude";
/**
- * The root group name.
+ * The latitude name.
*/
- private String rootGroupName = "MOD_Swath_LST";
-
+ private final String latitudeName = "Latitude";
/**
- * The geolocation field.
+ * The data field name.
*/
- private String geolocationField = "Geolocation_Fields";
-
+ private final String dataFieldName = "Data_Fields";
/**
- * The longitude name.
+ * The data variable list.
*/
- private String longitudeName = "Longitude";
-
+ private final String[] dataVariableList;
/**
- * The latitude name.
+ * The data path list.
*/
- private String latitudeName = "Latitude";
-
+ private final String[] dataPathList;
/**
- * The data field name.
+ * The offset.
*/
- private String dataFieldName = "Data_Fields";
-
+ private int offset = 0;
/**
- * The data variable name.
+ * The increment.
*/
- private String dataVariableName = "LST";
-
+ private int increment = 1;
/**
- * The data variable list.
+ * The root group name.
*/
- private String[] dataVariableList;
-
+ private String rootGroupName = "MOD_Swath_LST";
+ /**
+ * The data variable name.
+ */
+ private String dataVariableName = "LST";
/**
* The longitude path.
*/
private String longitudePath = "";
-
/**
* The latitude path.
*/
private String latitudePath = "";
-
/**
* The data path.
*/
private String dataPath = "";
-
- /**
- * The data path list.
- */
- private String[] dataPathList;
-
/**
* The switch coordinate XY. By default, longitude is X, latitude is Y
*/
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/FormatMapper.java b/core/src/main/java/org/apache/sedona/core/formatMapper/FormatMapper.java
similarity index 76%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/FormatMapper.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/FormatMapper.java
index f54fa4d..ccd7974 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/FormatMapper.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/FormatMapper.java
@@ -1,21 +1,28 @@
/*
- * FILE: FormatMapper
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper;
+package org.apache.sedona.core.formatMapper;
+
+import org.apache.log4j.Logger;
+import org.apache.sedona.core.enums.FileDataSplitter;
+import org.apache.sedona.core.enums.GeometryType;
+import org.apache.spark.api.java.function.FlatMapFunction;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.GeometryCollection;
@@ -27,10 +34,6 @@ import org.locationtech.jts.io.ParseException;
import org.locationtech.jts.io.WKBReader;
import org.locationtech.jts.io.WKTReader;
import org.locationtech.jts.operation.valid.IsValidOp;
-import org.apache.log4j.Logger;
-import org.apache.spark.api.java.function.FlatMapFunction;
-import org.datasyslab.geospark.enums.FileDataSplitter;
-import org.datasyslab.geospark.enums.GeometryType;
import org.wololo.geojson.Feature;
import org.wololo.geojson.GeoJSONFactory;
import org.wololo.jts2geojson.GeoJSONReader;
@@ -38,60 +41,57 @@ import org.wololo.jts2geojson.GeoJSONReader;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
public class FormatMapper<T extends Geometry>
implements Serializable, FlatMapFunction<Iterator<String>, T>
{
+ final static Logger logger = Logger.getLogger(FormatMapper.class);
/**
* The start offset.
*/
protected final int startOffset;
-
/**
* The end offset.
*/
- /* If the initial value is negative, GeoSpark will consider each field as a spatial attribute if the target object is LineString or Polygon. */
+ /* If the initial value is negative, Sedona will consider each field as a spatial attribute if the target object is LineString or Polygon. */
protected final int endOffset;
-
/**
* The splitter.
*/
protected final FileDataSplitter splitter;
-
/**
* The carry input data.
*/
protected final boolean carryInputData;
-
/**
* Non-spatial attributes in each input row will be concatenated to a tab separated string
*/
protected String otherAttributes = "";
-
protected GeometryType geometryType = null;
-
- /**
- * Allow mapping of invalid geometries.
- */
- boolean allowTopologicallyInvalidGeometries;
-
- /**
- * Crash on syntactically invalid geometries or skip them.
- */
- boolean skipSyntacticallyInvalidGeometries;
/**
* The factory.
*/
transient protected GeometryFactory factory = new GeometryFactory();
-
transient protected GeoJSONReader geoJSONReader = new GeoJSONReader();
-
transient protected WKTReader wktReader = new WKTReader();
+ /**
+ * Allow mapping of invalid geometries.
+ */
+ boolean allowTopologicallyInvalidGeometries;
// For some unknown reasons, the wkb reader cannot be used in transient variable like the wkt reader.
+ /**
+ * Crash on syntactically invalid geometries or skip them.
+ */
+ boolean skipSyntacticallyInvalidGeometries;
- final static Logger logger = Logger.getLogger(FormatMapper.class);
/**
* Instantiates a new format mapper.
*
@@ -110,25 +110,23 @@ public class FormatMapper<T extends Geometry>
this.allowTopologicallyInvalidGeometries = true;
this.skipSyntacticallyInvalidGeometries = false;
// Only the following formats are allowed to use this format mapper because each input has the geometry type definition
- if (geometryType == null)
- {
- assert splitter == FileDataSplitter.WKB || splitter == FileDataSplitter.WKT || splitter == FileDataSplitter.GEOJSON;
- }
+ assert geometryType != null || splitter == FileDataSplitter.WKB || splitter == FileDataSplitter.WKT || splitter == FileDataSplitter.GEOJSON;
}
/**
- * Instantiates a new format mapper. This is extensively used in GeoSparkSQL.
+ * Instantiates a new format mapper. This is extensively used in SedonaSQL.
+ *
* @param splitter
* @param carryInputData
*/
public FormatMapper(FileDataSplitter splitter, boolean carryInputData)
{
- this(0,-1,splitter,carryInputData, null);
+ this(0, -1, splitter, carryInputData, null);
}
-
/**
- * This format mapper is used in GeoSparkSQL.
+ * This format mapper is used in SedonaSQL.
+ *
* @param splitter
* @param carryInputData
* @param geometryType
@@ -138,6 +136,27 @@ public class FormatMapper<T extends Geometry>
this(0, -1, splitter, carryInputData, geometryType);
}
+ public static List<String> readGeoJsonPropertyNames(String geoJson)
+ {
+ if (geoJson.contains("Feature") || geoJson.contains("feature") || geoJson.contains("FEATURE")) {
+ if (geoJson.contains("properties")) {
+ Feature feature = (Feature) GeoJSONFactory.create(geoJson);
+ if (Objects.isNull(feature.getId())) {
+ return new ArrayList(feature.getProperties().keySet());
+ }
+ else {
+ List<String> propertyList = new ArrayList<>(Arrays.asList("id"));
+ for (String geoJsonProperty : feature.getProperties().keySet()) {
+ propertyList.add(geoJsonProperty);
+ }
+ return propertyList;
+ }
+ }
+ }
+ logger.warn("[Sedona] The GeoJSON file doesn't have feature properties");
+ return null;
+ }
+
private void readObject(ObjectInputStream inputStream)
throws IOException, ClassNotFoundException
{
@@ -151,7 +170,7 @@ public class FormatMapper<T extends Geometry>
{
LinkedList<String> splitedGeometryDataList = new LinkedList<String>(splitedGeometryData);
if (carryInputData) {
- if (this.splitter != FileDataSplitter.GEOJSON){
+ if (this.splitter != FileDataSplitter.GEOJSON) {
//remove spatial data position
splitedGeometryDataList.remove(this.startOffset);
}
@@ -166,19 +185,17 @@ public class FormatMapper<T extends Geometry>
Feature feature = (Feature) GeoJSONFactory.create(geoJson);
ArrayList<String> nonSpatialData = new ArrayList<>();
Map<String, Object> featurePropertiesproperties = feature.getProperties();
- if (feature.getId()!=null)
- {
+ if (feature.getId() != null) {
nonSpatialData.add(feature.getId().toString());
}
- if (featurePropertiesproperties!=null)
- {
- for (Object property:featurePropertiesproperties.values()
+ if (featurePropertiesproperties != null) {
+ for (Object property : featurePropertiesproperties.values()
) {
if (property == null) {
nonSpatialData.add("null");
}
else {
- nonSpatialData.add(property.toString());
+ nonSpatialData.add(property.toString());
}
}
}
@@ -191,31 +208,9 @@ public class FormatMapper<T extends Geometry>
return geometry;
}
-
-
- public static List<String> readGeoJsonPropertyNames(String geoJson){
- if (geoJson.contains("Feature") || geoJson.contains("feature") || geoJson.contains("FEATURE")) {
- if (geoJson.contains("properties") ) {
- Feature feature = (Feature) GeoJSONFactory.create(geoJson);
- if (Objects.isNull(feature.getId())){
- return new ArrayList(feature.getProperties().keySet());
- }
- else{
- List<String> propertyList = new ArrayList<>(Arrays.asList("id"));
- for (String geoJsonProperty: feature.getProperties().keySet()){
- propertyList.add(geoJsonProperty);
- }
- return propertyList;
- }
-
- }
- }
- logger.warn("[GeoSpark] The GeoJSON file doesn't have feature properties");
- return null;
- }
-
- public List<String> readPropertyNames(String geoString) {
- switch (splitter){
+ public List<String> readPropertyNames(String geoString)
+ {
+ switch (splitter) {
case GEOJSON:
return readGeoJsonPropertyNames(geoString);
default:
@@ -232,10 +227,10 @@ public class FormatMapper<T extends Geometry>
try {
geometry = wktReader.read(columns[this.startOffset]);
}
- catch (Exception e){
- logger.error("[GeoSpark] " + e.getMessage());
+ catch (Exception e) {
+ logger.error("[Sedona] " + e.getMessage());
}
- if (geometry == null){
+ if (geometry == null) {
return null;
}
handleNonSpatialDataToGeometry(geometry, Arrays.asList(columns));
@@ -258,32 +253,27 @@ public class FormatMapper<T extends Geometry>
public Coordinate[] readCoordinates(String line)
{
final String[] columns = line.split(splitter.getDelimiter());
- final int actualEndOffset = this.endOffset >= 0 ? this.endOffset : (this.geometryType == GeometryType.POINT? startOffset+1:columns.length - 1);
+ final int actualEndOffset = this.endOffset >= 0 ? this.endOffset : (this.geometryType == GeometryType.POINT ? startOffset + 1 : columns.length - 1);
final Coordinate[] coordinates = new Coordinate[(actualEndOffset - startOffset + 1) / 2];
for (int i = this.startOffset; i <= actualEndOffset; i += 2) {
- coordinates[(i - startOffset) / 2 ] = new Coordinate(Double.parseDouble(columns[i]), Double.parseDouble(columns[i + 1]));
+ coordinates[(i - startOffset) / 2] = new Coordinate(Double.parseDouble(columns[i]), Double.parseDouble(columns[i + 1]));
}
- if (carryInputData)
- {
+ if (carryInputData) {
boolean firstColumnFlag = true;
otherAttributes = "";
- for (int i= 0;i<this.startOffset;i++)
- {
- if (firstColumnFlag)
- {
+ for (int i = 0; i < this.startOffset; i++) {
+ if (firstColumnFlag) {
otherAttributes += columns[i];
firstColumnFlag = false;
}
- else otherAttributes += "\t" + columns[i];
+ else { otherAttributes += "\t" + columns[i]; }
}
- for (int i=actualEndOffset+1;i<columns.length;i++)
- {
- if (firstColumnFlag)
- {
+ for (int i = actualEndOffset + 1; i < columns.length; i++) {
+ if (firstColumnFlag) {
otherAttributes += columns[i];
firstColumnFlag = false;
}
- else otherAttributes += "\t" + columns[i];
+ else { otherAttributes += "\t" + columns[i]; }
}
}
return coordinates;
@@ -315,21 +305,21 @@ public class FormatMapper<T extends Geometry>
break;
default: {
if (this.geometryType == null) {
- throw new IllegalArgumentException("[GeoSpark][FormatMapper] You must specify GeometryType when you use delimiter rather than WKB, WKT or GeoJSON");
- } else {
+ throw new IllegalArgumentException("[Sedona][FormatMapper] You must specify GeometryType when you use delimiter rather than WKB, WKT or GeoJSON");
+ }
+ else {
geometry = createGeometry(readCoordinates(line), geometryType);
}
}
}
-
}
- catch (Exception e){
- logger.error("[GeoSpark] " + e.getMessage());
- if (skipSyntacticallyInvalidGeometries == false){
+ catch (Exception e) {
+ logger.error("[Sedona] " + e.getMessage());
+ if (skipSyntacticallyInvalidGeometries == false) {
throw e;
}
}
- if (geometry == null){
+ if (geometry == null) {
return null;
}
if (allowTopologicallyInvalidGeometries == false) {
@@ -358,7 +348,7 @@ public class FormatMapper<T extends Geometry>
break;
case RECTANGLE:
// The rectangle mapper reads two coordinates from the input line. The two coordinates are the two on the diagonal.
- assert coordinates.length == 2;
+ assert coordinates.length == 2;
Coordinate[] polyCoordinates = new Coordinate[5];
polyCoordinates[0] = coordinates[0];
polyCoordinates[1] = new Coordinate(coordinates[0].x, coordinates[1].y);
@@ -367,12 +357,11 @@ public class FormatMapper<T extends Geometry>
polyCoordinates[4] = polyCoordinates[0];
geometry = factory.createPolygon(polyCoordinates);
break;
- // Read string to point if no geometry type specified but GeoSpark should never reach here
+ // Read string to point if no geometry type specified but Sedona should never reach here
default:
geometry = geometryFactory.createPoint(coordinates[0]);
}
- if (carryInputData)
- {
+ if (carryInputData) {
geometry.setUserData(otherAttributes);
}
return geometry;
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/GeoJsonReader.java b/core/src/main/java/org/apache/sedona/core/formatMapper/GeoJsonReader.java
similarity index 62%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/GeoJsonReader.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/GeoJsonReader.java
index ce123b3..d465302 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/GeoJsonReader.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/GeoJsonReader.java
@@ -1,49 +1,57 @@
/*
- * FILE: GeoJsonReader
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper;
-import org.locationtech.jts.geom.Geometry;
+package org.apache.sedona.core.formatMapper;
+
+import org.apache.sedona.core.enums.FileDataSplitter;
+import org.apache.sedona.core.spatialRDD.SpatialRDD;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
-import org.datasyslab.geospark.enums.FileDataSplitter;
-import org.datasyslab.geospark.spatialRDD.SpatialRDD;
+import org.locationtech.jts.geom.Geometry;
-public class GeoJsonReader extends RddReader
+public class GeoJsonReader
+ extends RddReader
{
/**
* Read a SpatialRDD from a file.
+ *
* @param sc
* @param inputPath
* @return
*/
- public static SpatialRDD<Geometry> readToGeometryRDD(JavaSparkContext sc, String inputPath) {
+ public static SpatialRDD<Geometry> readToGeometryRDD(JavaSparkContext sc, String inputPath)
+ {
return readToGeometryRDD(sc, inputPath, true, false);
}
/**
* Read a SpatialRDD from a file.
+ *
* @param sc
* @param inputPath
* @param allowInvalidGeometries whether allows topology-invalid geometries exist in the generated RDD
- * @param skipSyntacticallyInvalidGeometries whether allows GeoSpark to automatically skip syntax-invalid geometries, rather than throw errors
+ * @param skipSyntacticallyInvalidGeometries whether allows Sedona to automatically skip syntax-invalid geometries, rather than throw errors
* @return
*/
- public static SpatialRDD<Geometry> readToGeometryRDD(JavaSparkContext sc, String inputPath, boolean allowInvalidGeometries, boolean skipSyntacticallyInvalidGeometries) {
+ public static SpatialRDD<Geometry> readToGeometryRDD(JavaSparkContext sc, String inputPath, boolean allowInvalidGeometries, boolean skipSyntacticallyInvalidGeometries)
+ {
JavaRDD rawTextRDD = sc.textFile(inputPath);
FormatMapper<Geometry> formatMapper = new FormatMapper<Geometry>(FileDataSplitter.GEOJSON, true);
formatMapper.allowTopologicallyInvalidGeometries = allowInvalidGeometries;
@@ -53,21 +61,25 @@ public class GeoJsonReader extends RddReader
/**
* Read a SpatialRDD from a string type rdd.
+ *
* @param rawTextRDD a string type RDD
* @return
*/
- public static SpatialRDD<Geometry> readToGeometryRDD(JavaRDD rawTextRDD) {
+ public static SpatialRDD<Geometry> readToGeometryRDD(JavaRDD rawTextRDD)
+ {
return readToGeometryRDD(rawTextRDD, true, false);
}
/**
* Read a SpatialRDD from a string type rdd.
+ *
* @param rawTextRDD a string type RDD
* @param allowInvalidGeometries whether allows topology-invalid geometries exist in the generated RDD
- * @param skipSyntacticallyInvalidGeometries whether allows GeoSpark to automatically skip syntax-invalid geometries, rather than throw errors
+ * @param skipSyntacticallyInvalidGeometries whether allows Sedona to automatically skip syntax-invalid geometries, rather than throw errors
* @return
*/
- public static SpatialRDD<Geometry> readToGeometryRDD(JavaRDD rawTextRDD, boolean allowInvalidGeometries, boolean skipSyntacticallyInvalidGeometries) {
+ public static SpatialRDD<Geometry> readToGeometryRDD(JavaRDD rawTextRDD, boolean allowInvalidGeometries, boolean skipSyntacticallyInvalidGeometries)
+ {
FormatMapper<Geometry> formatMapper = new FormatMapper<Geometry>(FileDataSplitter.GEOJSON, true);
formatMapper.allowTopologicallyInvalidGeometries = allowInvalidGeometries;
formatMapper.skipSyntacticallyInvalidGeometries = skipSyntacticallyInvalidGeometries;
diff --git a/core/src/main/java/org/apache/sedona/core/formatMapper/LineStringFormatMapper.java b/core/src/main/java/org/apache/sedona/core/formatMapper/LineStringFormatMapper.java
new file mode 100644
index 0000000..d1711fb
--- /dev/null
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/LineStringFormatMapper.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.formatMapper;
+
+import org.apache.sedona.core.enums.FileDataSplitter;
+import org.apache.sedona.core.enums.GeometryType;
+
+public class LineStringFormatMapper
+ extends FormatMapper
+{
+
+ /**
+ * Instantiates a new line string format mapper.
+ *
+ * @param Splitter the splitter
+ * @param carryInputData the carry input data
+ */
+ public LineStringFormatMapper(FileDataSplitter Splitter, boolean carryInputData)
+ {
+ super(0, -1, Splitter, carryInputData, GeometryType.LINESTRING);
+ }
+
+ /**
+ * Instantiates a new line string format mapper.
+ *
+ * @param startOffset the start offset
+ * @param endOffset the end offset
+ * @param Splitter the splitter
+ * @param carryInputData the carry input data
+ */
+ public LineStringFormatMapper(Integer startOffset, Integer endOffset, FileDataSplitter Splitter,
+ boolean carryInputData)
+ {
+ super(startOffset, endOffset, Splitter, carryInputData, GeometryType.LINESTRING);
+ }
+}
\ No newline at end of file
diff --git a/core/src/main/java/org/apache/sedona/core/formatMapper/PointFormatMapper.java b/core/src/main/java/org/apache/sedona/core/formatMapper/PointFormatMapper.java
new file mode 100644
index 0000000..c9b74ea
--- /dev/null
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/PointFormatMapper.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.formatMapper;
+
+import org.apache.sedona.core.enums.FileDataSplitter;
+import org.apache.sedona.core.enums.GeometryType;
+
+public class PointFormatMapper
+ extends FormatMapper
+{
+
+ /**
+ * Instantiates a new point format mapper.
+ *
+ * @param Splitter the splitter
+ * @param carryInputData the carry input data
+ */
+ public PointFormatMapper(FileDataSplitter Splitter, boolean carryInputData)
+ {
+ super(0, 1, Splitter, carryInputData, GeometryType.POINT);
+ }
+
+ /**
+ * Instantiates a new point format mapper.
+ *
+ * @param startOffset the start offset
+ * @param Splitter the splitter
+ * @param carryInputData the carry input data
+ */
+ public PointFormatMapper(Integer startOffset, FileDataSplitter Splitter,
+ boolean carryInputData)
+ {
+ super(startOffset, startOffset + 1, Splitter, carryInputData, GeometryType.POINT);
+ }
+}
diff --git a/core/src/main/java/org/apache/sedona/core/formatMapper/PolygonFormatMapper.java b/core/src/main/java/org/apache/sedona/core/formatMapper/PolygonFormatMapper.java
new file mode 100644
index 0000000..d442a77
--- /dev/null
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/PolygonFormatMapper.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.formatMapper;
+
+import org.apache.sedona.core.enums.FileDataSplitter;
+import org.apache.sedona.core.enums.GeometryType;
+
+public class PolygonFormatMapper
+ extends FormatMapper
+{
+
+ /**
+ * Instantiates a new polygon format mapper.
+ *
+ * @param Splitter the splitter
+ * @param carryInputData the carry input data
+ */
+ public PolygonFormatMapper(FileDataSplitter Splitter, boolean carryInputData)
+ {
+ super(0, -1, Splitter, carryInputData, GeometryType.POLYGON);
+ }
+
+ /**
+ * Instantiates a new polygon format mapper.
+ *
+ * @param startOffset the start offset
+ * @param endOffset the end offset
+ * @param Splitter the splitter
+ * @param carryInputData the carry input data
+ */
+ public PolygonFormatMapper(Integer startOffset, Integer endOffset, FileDataSplitter Splitter,
+ boolean carryInputData)
+ {
+ super(startOffset, endOffset, Splitter, carryInputData, GeometryType.POLYGON);
+ }
+}
\ No newline at end of file
diff --git a/core/src/main/java/org/apache/sedona/core/formatMapper/RddReader.java b/core/src/main/java/org/apache/sedona/core/formatMapper/RddReader.java
new file mode 100644
index 0000000..d685006
--- /dev/null
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/RddReader.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.formatMapper;
+
+import org.apache.sedona.core.spatialRDD.SpatialRDD;
+import org.apache.spark.api.java.JavaRDD;
+import org.locationtech.jts.geom.Geometry;
+
+class RddReader
+{
+ public static SpatialRDD<Geometry> createSpatialRDD(JavaRDD rawTextRDD, FormatMapper<Geometry> formatMapper)
+ {
+ SpatialRDD spatialRDD = new SpatialRDD<Geometry>();
+ spatialRDD.rawSpatialRDD = rawTextRDD.mapPartitions(formatMapper);
+ spatialRDD.fieldNames = formatMapper.readPropertyNames(rawTextRDD.take(1).get(0).toString());
+ return spatialRDD;
+ }
+}
diff --git a/core/src/main/java/org/apache/sedona/core/formatMapper/RectangleFormatMapper.java b/core/src/main/java/org/apache/sedona/core/formatMapper/RectangleFormatMapper.java
new file mode 100644
index 0000000..e935265
--- /dev/null
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/RectangleFormatMapper.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.formatMapper;
+
+import org.apache.sedona.core.enums.FileDataSplitter;
+import org.apache.sedona.core.enums.GeometryType;
+
+public class RectangleFormatMapper
+ extends FormatMapper
+{
+
+ /**
+ * Instantiates a new rectangle format mapper.
+ *
+ * @param Splitter the splitter
+ * @param carryInputData the carry input data
+ */
+ public RectangleFormatMapper(FileDataSplitter Splitter, boolean carryInputData)
+ {
+ super(0, 3, Splitter, carryInputData, GeometryType.RECTANGLE);
+ }
+
+ /**
+ * Instantiates a new rectangle format mapper.
+ *
+ * @param startOffset the start offset
+ * @param Splitter the splitter
+ * @param carryInputData the carry input data
+ */
+ public RectangleFormatMapper(Integer startOffset, FileDataSplitter Splitter,
+ boolean carryInputData)
+ {
+ super(startOffset, startOffset + 3, Splitter, carryInputData, GeometryType.RECTANGLE);
+ }
+}
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/WkbReader.java b/core/src/main/java/org/apache/sedona/core/formatMapper/WkbReader.java
similarity index 60%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/WkbReader.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/WkbReader.java
index 247cf02..f7912b7 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/WkbReader.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/WkbReader.java
@@ -1,39 +1,45 @@
/*
- * FILE: WkbReader
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper;
-import org.locationtech.jts.geom.Geometry;
+package org.apache.sedona.core.formatMapper;
+
+import org.apache.sedona.core.enums.FileDataSplitter;
+import org.apache.sedona.core.spatialRDD.SpatialRDD;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
-import org.datasyslab.geospark.enums.FileDataSplitter;
-import org.datasyslab.geospark.spatialRDD.SpatialRDD;
+import org.locationtech.jts.geom.Geometry;
-public class WkbReader extends RddReader
+public class WkbReader
+ extends RddReader
{
/**
* Read a SpatialRDD from a file.
+ *
* @param sc
* @param inputPath
* @param wkbColumn The column which contains the wkt string. Start from 0.
* @param allowInvalidGeometries whether allows topology-invalid geometries exist in the generated RDD
- * @param skipSyntacticallyInvalidGeometries whether allows GeoSpark to automatically skip syntax-invalid geometries, rather than throw errors
+ * @param skipSyntacticallyInvalidGeometries whether allows Sedona to automatically skip syntax-invalid geometries, rather than throw errors
* @return
*/
- public static SpatialRDD<Geometry> readToGeometryRDD(JavaSparkContext sc, String inputPath, int wkbColumn, boolean allowInvalidGeometries, boolean skipSyntacticallyInvalidGeometries) {
+ public static SpatialRDD<Geometry> readToGeometryRDD(JavaSparkContext sc, String inputPath, int wkbColumn, boolean allowInvalidGeometries, boolean skipSyntacticallyInvalidGeometries)
+ {
JavaRDD rawTextRDD = sc.textFile(inputPath);
FormatMapper<Geometry> formatMapper = new FormatMapper<Geometry>(wkbColumn, -1, FileDataSplitter.WKB, true, null);
formatMapper.allowTopologicallyInvalidGeometries = allowInvalidGeometries;
@@ -43,13 +49,15 @@ public class WkbReader extends RddReader
/**
* Read a SpatialRDD from a string type rdd.
+ *
* @param rawTextRDD a string type RDD
* @param wkbColumn The column which contains the wkt string. Start from 0.
* @param allowInvalidGeometries whether allows topology-invalid geometries exist in the generated RDD
- * @param skipSyntacticallyInvalidGeometries whether allows GeoSpark to automatically skip syntax-invalid geometries, rather than throw errors
+ * @param skipSyntacticallyInvalidGeometries whether allows Sedona to automatically skip syntax-invalid geometries, rather than throw errors
* @return
*/
- public static SpatialRDD<Geometry> readToGeometryRDD(JavaRDD rawTextRDD, int wkbColumn, boolean allowInvalidGeometries, boolean skipSyntacticallyInvalidGeometries) {
+ public static SpatialRDD<Geometry> readToGeometryRDD(JavaRDD rawTextRDD, int wkbColumn, boolean allowInvalidGeometries, boolean skipSyntacticallyInvalidGeometries)
+ {
FormatMapper<Geometry> formatMapper = new FormatMapper<Geometry>(wkbColumn, -1, FileDataSplitter.WKB, true, null);
formatMapper.allowTopologicallyInvalidGeometries = allowInvalidGeometries;
formatMapper.skipSyntacticallyInvalidGeometries = skipSyntacticallyInvalidGeometries;
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/WktReader.java b/core/src/main/java/org/apache/sedona/core/formatMapper/WktReader.java
similarity index 60%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/WktReader.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/WktReader.java
index b53e17e..86b0c98 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/WktReader.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/WktReader.java
@@ -1,39 +1,45 @@
/*
- * FILE: WktReader
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper;
-import org.locationtech.jts.geom.Geometry;
+package org.apache.sedona.core.formatMapper;
+
+import org.apache.sedona.core.enums.FileDataSplitter;
+import org.apache.sedona.core.spatialRDD.SpatialRDD;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
-import org.datasyslab.geospark.enums.FileDataSplitter;
-import org.datasyslab.geospark.spatialRDD.SpatialRDD;
+import org.locationtech.jts.geom.Geometry;
-public class WktReader extends RddReader
+public class WktReader
+ extends RddReader
{
/**
* Read a SpatialRDD from a file.
+ *
* @param sc
* @param inputPath
* @param wktColumn The column which contains the wkt string. Start from 0.
* @param allowInvalidGeometries whether allows topology-invalid geometries exist in the generated RDD
- * @param skipSyntacticallyInvalidGeometries whether allows GeoSpark to automatically skip syntax-invalid geometries, rather than throw errors
+ * @param skipSyntacticallyInvalidGeometries whether allows Sedona to automatically skip syntax-invalid geometries, rather than throw errors
* @return
*/
- public static SpatialRDD<Geometry> readToGeometryRDD(JavaSparkContext sc, String inputPath, int wktColumn, boolean allowInvalidGeometries, boolean skipSyntacticallyInvalidGeometries) {
+ public static SpatialRDD<Geometry> readToGeometryRDD(JavaSparkContext sc, String inputPath, int wktColumn, boolean allowInvalidGeometries, boolean skipSyntacticallyInvalidGeometries)
+ {
JavaRDD rawTextRDD = sc.textFile(inputPath);
FormatMapper<Geometry> formatMapper = new FormatMapper<Geometry>(wktColumn, -1, FileDataSplitter.WKT, true, null);
formatMapper.allowTopologicallyInvalidGeometries = allowInvalidGeometries;
@@ -43,13 +49,15 @@ public class WktReader extends RddReader
/**
* Read a SpatialRDD from a string type rdd.
+ *
* @param rawTextRDD a string type RDD
* @param wktColumn The column which contains the wkt string. Start from 0.
* @param allowInvalidGeometries whether allows topology-invalid geometries exist in the generated RDD
- * @param skipSyntacticallyInvalidGeometries whether allows GeoSpark to automatically skip syntax-invalid geometries, rather than throw errors
+ * @param skipSyntacticallyInvalidGeometries whether allows Sedona to automatically skip syntax-invalid geometries, rather than throw errors
* @return
*/
- public static SpatialRDD<Geometry> readToGeometryRDD(JavaRDD rawTextRDD, int wktColumn, boolean allowInvalidGeometries, boolean skipSyntacticallyInvalidGeometries) {
+ public static SpatialRDD<Geometry> readToGeometryRDD(JavaRDD rawTextRDD, int wktColumn, boolean allowInvalidGeometries, boolean skipSyntacticallyInvalidGeometries)
+ {
FormatMapper<Geometry> formatMapper = new FormatMapper<Geometry>(wktColumn, -1, FileDataSplitter.WKT, true, null);
formatMapper.allowTopologicallyInvalidGeometries = allowInvalidGeometries;
formatMapper.skipSyntacticallyInvalidGeometries = skipSyntacticallyInvalidGeometries;
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/ShapefileRDD.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/ShapefileRDD.java
similarity index 85%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/ShapefileRDD.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/ShapefileRDD.java
index 8ef80bc..ccd8d2a 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/ShapefileRDD.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/ShapefileRDD.java
@@ -1,21 +1,37 @@
/*
- * FILE: ShapefileRDD
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper.shapefileParser;
+package org.apache.sedona.core.formatMapper.shapefileParser;
+
+import org.apache.sedona.core.formatMapper.shapefileParser.boundary.BoundBox;
+import org.apache.sedona.core.formatMapper.shapefileParser.boundary.BoundaryInputFormat;
+import org.apache.sedona.core.formatMapper.shapefileParser.parseUtils.shp.TypeUnknownException;
+import org.apache.sedona.core.formatMapper.shapefileParser.shapes.PrimitiveShape;
+import org.apache.sedona.core.formatMapper.shapefileParser.shapes.ShapeInputFormat;
+import org.apache.sedona.core.formatMapper.shapefileParser.shapes.ShapeKey;
+import org.apache.spark.api.java.JavaPairRDD;
+import org.apache.spark.api.java.JavaRDD;
+import org.apache.spark.api.java.JavaSparkContext;
+import org.apache.spark.api.java.function.FlatMapFunction;
+import org.apache.spark.api.java.function.Function;
+import org.apache.spark.api.java.function.Function2;
+import org.apache.spark.api.java.function.VoidFunction;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.LineString;
@@ -24,19 +40,6 @@ import org.locationtech.jts.geom.MultiPoint;
import org.locationtech.jts.geom.MultiPolygon;
import org.locationtech.jts.geom.Point;
import org.locationtech.jts.geom.Polygon;
-import org.apache.spark.api.java.JavaPairRDD;
-import org.apache.spark.api.java.JavaRDD;
-import org.apache.spark.api.java.JavaSparkContext;
-import org.apache.spark.api.java.function.FlatMapFunction;
-import org.apache.spark.api.java.function.Function;
-import org.apache.spark.api.java.function.Function2;
-import org.apache.spark.api.java.function.VoidFunction;
-import org.datasyslab.geospark.formatMapper.shapefileParser.boundary.BoundBox;
-import org.datasyslab.geospark.formatMapper.shapefileParser.boundary.BoundaryInputFormat;
-import org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp.TypeUnknownException;
-import org.datasyslab.geospark.formatMapper.shapefileParser.shapes.PrimitiveShape;
-import org.datasyslab.geospark.formatMapper.shapefileParser.shapes.ShapeInputFormat;
-import org.datasyslab.geospark.formatMapper.shapefileParser.shapes.ShapeKey;
import scala.Tuple2;
import java.io.IOException;
@@ -56,39 +59,9 @@ public class ShapefileRDD
{
/**
- * shape collection.
- */
- private JavaRDD<Geometry> shapeRDD = null;
-
- /**
* The geometry factory.
*/
public static GeometryFactory geometryFactory = new GeometryFactory();
-
- /**
- * bounding box.
- */
- private BoundBox boundBox = null;
-
- /**
- * ShapefileRDD.
- *
- * @param sparkContext the spark context
- * @param filePath the file path
- */
- public ShapefileRDD(JavaSparkContext sparkContext, String filePath)
- {
- boundBox = new BoundBox();
- JavaPairRDD<ShapeKey, PrimitiveShape> shapePrimitiveRdd = sparkContext.newAPIHadoopFile(
- filePath,
- ShapeInputFormat.class,
- ShapeKey.class,
- PrimitiveShape.class,
- sparkContext.hadoopConfiguration()
- );
- shapeRDD = shapePrimitiveRdd.map(PrimitiveToShape);
- }
-
/**
* The Constant PrimitiveToShape.
*/
@@ -113,7 +86,6 @@ public class ShapefileRDD
}
}
};
-
/**
* The Print shape.
*/
@@ -125,6 +97,33 @@ public class ShapefileRDD
System.out.println(shape.toText());
}
};
+ /**
+ * shape collection.
+ */
+ private JavaRDD<Geometry> shapeRDD = null;
+ /**
+ * bounding box.
+ */
+ private BoundBox boundBox = null;
+
+ /**
+ * ShapefileRDD.
+ *
+ * @param sparkContext the spark context
+ * @param filePath the file path
+ */
+ public ShapefileRDD(JavaSparkContext sparkContext, String filePath)
+ {
+ boundBox = new BoundBox();
+ JavaPairRDD<ShapeKey, PrimitiveShape> shapePrimitiveRdd = sparkContext.newAPIHadoopFile(
+ filePath,
+ ShapeInputFormat.class,
+ ShapeKey.class,
+ PrimitiveShape.class,
+ sparkContext.hadoopConfiguration()
+ );
+ shapeRDD = shapePrimitiveRdd.map(PrimitiveToShape);
+ }
/**
* Gets the shape RDD.
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/ShapefileReader.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/ShapefileReader.java
similarity index 86%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/ShapefileReader.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/ShapefileReader.java
index cc96cc3..95c66e2 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/ShapefileReader.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/ShapefileReader.java
@@ -1,21 +1,40 @@
/*
- * FILE: ShapefileReader
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper.shapefileParser;
+package org.apache.sedona.core.formatMapper.shapefileParser;
+
+import org.apache.sedona.core.formatMapper.shapefileParser.boundary.BoundBox;
+import org.apache.sedona.core.formatMapper.shapefileParser.boundary.BoundaryInputFormat;
+import org.apache.sedona.core.formatMapper.shapefileParser.fieldname.FieldnameInputFormat;
+import org.apache.sedona.core.formatMapper.shapefileParser.shapes.PrimitiveShape;
+import org.apache.sedona.core.formatMapper.shapefileParser.shapes.ShapeInputFormat;
+import org.apache.sedona.core.formatMapper.shapefileParser.shapes.ShapeKey;
+import org.apache.sedona.core.spatialRDD.LineStringRDD;
+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.api.java.JavaPairRDD;
+import org.apache.spark.api.java.JavaRDD;
+import org.apache.spark.api.java.JavaSparkContext;
+import org.apache.spark.api.java.function.FlatMapFunction;
+import org.apache.spark.api.java.function.Function;
+import org.apache.spark.api.java.function.Function2;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.LineString;
@@ -24,22 +43,6 @@ import org.locationtech.jts.geom.MultiPoint;
import org.locationtech.jts.geom.MultiPolygon;
import org.locationtech.jts.geom.Point;
import org.locationtech.jts.geom.Polygon;
-import org.apache.spark.api.java.JavaPairRDD;
-import org.apache.spark.api.java.JavaRDD;
-import org.apache.spark.api.java.JavaSparkContext;
-import org.apache.spark.api.java.function.FlatMapFunction;
-import org.apache.spark.api.java.function.Function;
-import org.apache.spark.api.java.function.Function2;
-import org.datasyslab.geospark.formatMapper.shapefileParser.boundary.BoundBox;
-import org.datasyslab.geospark.formatMapper.shapefileParser.boundary.BoundaryInputFormat;
-import org.datasyslab.geospark.formatMapper.shapefileParser.fieldname.FieldnameInputFormat;
-import org.datasyslab.geospark.formatMapper.shapefileParser.shapes.PrimitiveShape;
-import org.datasyslab.geospark.formatMapper.shapefileParser.shapes.ShapeInputFormat;
-import org.datasyslab.geospark.formatMapper.shapefileParser.shapes.ShapeKey;
-import org.datasyslab.geospark.spatialRDD.LineStringRDD;
-import org.datasyslab.geospark.spatialRDD.PointRDD;
-import org.datasyslab.geospark.spatialRDD.PolygonRDD;
-import org.datasyslab.geospark.spatialRDD.SpatialRDD;
import scala.Tuple2;
import java.io.IOException;
@@ -154,14 +157,15 @@ public class ShapefileReader
}
/**
- *
* @param sc Spark Context
* @param inputPath folder which contains shape file with dbf metadata file
* @return List of Strings if dbf file was found; return null if no dbf file
* @throws IOException
*/
- public static List<String> readFieldNames(JavaSparkContext sc, String inputPath) throws IOException {
+ public static List<String> readFieldNames(JavaSparkContext sc, String inputPath)
+ throws IOException
+ {
// read bound boxes into memory
JavaPairRDD<Long, String> fieldDescriptors = sc.newAPIHadoopFile(
inputPath,
@@ -177,20 +181,20 @@ public class ShapefileReader
public String call(String descripter1, String descripter2)
throws Exception
{
- return descripter1 + " "+ descripter2;
+ return descripter1 + " " + descripter2;
}
});
// if there is a result assign it to variable : fieldNames
List<String> result = Arrays.asList(fieldDescriptors.collect().get(0)._2().split("\t"));
- if (result.size()>1) {
+ if (result.size() > 1) {
return result;
}
- else if (result.size()==1) {
+ else if (result.size() == 1) {
// Sometimes the result has an empty string, we need to remove it
- if (result.get(0).equalsIgnoreCase("")) return null;
+ if (result.get(0).equalsIgnoreCase("")) { return null; }
return result;
}
- else return null;
+ else { return null; }
}
/**
*
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/boundary/BoundBox.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/boundary/BoundBox.java
similarity index 82%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/boundary/BoundBox.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/boundary/BoundBox.java
index 032675c..b959fec 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/boundary/BoundBox.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/boundary/BoundBox.java
@@ -1,20 +1,23 @@
/*
- * FILE: BoundBox
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper.shapefileParser.boundary;
+
+package org.apache.sedona.core.formatMapper.shapefileParser.boundary;
import java.io.Serializable;
import java.util.Arrays;
@@ -60,6 +63,31 @@ public class BoundBox
}
/**
+ * calculate the union of two bound box
+ *
+ * @param box1
+ * @param box2
+ * @return
+ */
+ public static BoundBox mergeBoundBox(BoundBox box1, BoundBox box2)
+ {
+ BoundBox box = new BoundBox();
+ // merge X
+ box.setXMin(Math.min(box1.getXMin(), box2.getXMin()));
+ box.setXMax(Math.max(box1.getXMax(), box2.getXMax()));
+ // merge Y
+ box.setYMin(Math.min(box1.getYMin(), box2.getYMin()));
+ box.setYMax(Math.max(box1.getYMax(), box2.getYMax()));
+ // merge Z
+ box.setZMin(Math.min(box1.getZMin(), box2.getZMin()));
+ box.setZMax(Math.max(box1.getZMax(), box2.getZMax()));
+ // merge M
+ box.setMMin(Math.min(box1.getMMin(), box2.getMMin()));
+ box.setMMax(Math.max(box1.getMMax(), box2.getMMax()));
+ return box;
+ }
+
+ /**
* set tuple at i with value
*
* @param i
@@ -96,6 +124,14 @@ public class BoundBox
}
/**
+ * get min X
+ */
+ public double getXMin()
+ {
+ return bounds[0];
+ }
+
+ /**
* set min X
*/
public void setXMin(double value)
@@ -104,11 +140,11 @@ public class BoundBox
}
/**
- * set min Y
+ * get max X
*/
- public void setYMin(double value)
+ public double getXMax()
{
- bounds[1] = value;
+ return bounds[2];
}
/**
@@ -120,99 +156,83 @@ public class BoundBox
}
/**
- * set max Y
- */
- public void setYMax(double value)
- {
- bounds[3] = value;
- }
-
- /**
- * set min Z
- */
- public void setZMin(double value)
- {
- bounds[4] = value;
- }
-
- /**
- * set max Z
+ * get min Y
*/
- public void setZMax(double value)
+ public double getYMin()
{
- bounds[5] = value;
+ return bounds[1];
}
/**
- * set min M
+ * set min Y
*/
- public void setMMin(double value)
+ public void setYMin(double value)
{
- bounds[6] = value;
+ bounds[1] = value;
}
/**
- * set max M
+ * get max Y
*/
- public void setMMax(double value)
+ public double getYMax()
{
- bounds[7] = value;
+ return bounds[3];
}
/**
- * get min X
+ * set max Y
*/
- public double getXMin()
+ public void setYMax(double value)
{
- return bounds[0];
+ bounds[3] = value;
}
/**
- * get max X
+ * get min Z
*/
- public double getXMax()
+ public double getZMin()
{
- return bounds[2];
+ return bounds[4];
}
/**
- * get min Y
+ * set min Z
*/
- public double getYMin()
+ public void setZMin(double value)
{
- return bounds[1];
+ bounds[4] = value;
}
/**
- * get max Y
+ * get max Z
*/
- public double getYMax()
+ public double getZMax()
{
- return bounds[3];
+ return bounds[5];
}
/**
- * get min Z
+ * set max Z
*/
- public double getZMin()
+ public void setZMax(double value)
{
- return bounds[4];
+ bounds[5] = value;
}
/**
- * get max Z
+ * get min M
*/
- public double getZMax()
+ public double getMMin()
{
- return bounds[5];
+ return bounds[6];
}
/**
- * get min M
+ * set min M
*/
- public double getMMin()
+ public void setMMin(double value)
{
- return bounds[6];
+ bounds[6] = value;
}
/**
@@ -224,27 +244,10 @@ public class BoundBox
}
/**
- * calculate the union of two bound box
- *
- * @param box1
- * @param box2
- * @return
+ * set max M
*/
- public static BoundBox mergeBoundBox(BoundBox box1, BoundBox box2)
+ public void setMMax(double value)
{
- BoundBox box = new BoundBox();
- // merge X
- box.setXMin(Math.min(box1.getXMin(), box2.getXMin()));
- box.setXMax(Math.max(box1.getXMax(), box2.getXMax()));
- // merge Y
- box.setYMin(Math.min(box1.getYMin(), box2.getYMin()));
- box.setYMax(Math.max(box1.getYMax(), box2.getYMax()));
- // merge Z
- box.setZMin(Math.min(box1.getZMin(), box2.getZMin()));
- box.setZMax(Math.max(box1.getZMax(), box2.getZMax()));
- // merge M
- box.setMMin(Math.min(box1.getMMin(), box2.getMMin()));
- box.setMMax(Math.max(box1.getMMax(), box2.getMMax()));
- return box;
+ bounds[7] = value;
}
}
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/boundary/BoundaryInputFormat.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/boundary/BoundaryInputFormat.java
similarity index 74%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/boundary/BoundaryInputFormat.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/boundary/BoundaryInputFormat.java
index 1038b0a..327f5eb 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/boundary/BoundaryInputFormat.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/boundary/BoundaryInputFormat.java
@@ -1,20 +1,23 @@
/*
- * FILE: BoundaryInputFormat
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper.shapefileParser.boundary;
+
+package org.apache.sedona.core.formatMapper.shapefileParser.boundary;
import org.apache.commons.io.FilenameUtils;
import org.apache.hadoop.fs.Path;
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/boundary/BoundaryRecordReader.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/boundary/BoundaryRecordReader.java
similarity index 75%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/boundary/BoundaryRecordReader.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/boundary/BoundaryRecordReader.java
index 80c4b2e..3de4749 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/boundary/BoundaryRecordReader.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/boundary/BoundaryRecordReader.java
@@ -1,20 +1,23 @@
/*
- * FILE: BoundaryRecordReader
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper.shapefileParser.boundary;
+
+package org.apache.sedona.core.formatMapper.shapefileParser.boundary;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream;
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/fieldname/FieldnameInputFormat.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/fieldname/FieldnameInputFormat.java
similarity index 74%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/fieldname/FieldnameInputFormat.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/fieldname/FieldnameInputFormat.java
index fbcee8e..4ab8392 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/fieldname/FieldnameInputFormat.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/fieldname/FieldnameInputFormat.java
@@ -1,20 +1,23 @@
/*
- * FILE: FieldnameInputFormat
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper.shapefileParser.fieldname;
+
+package org.apache.sedona.core.formatMapper.shapefileParser.fieldname;
import org.apache.commons.io.FilenameUtils;
import org.apache.hadoop.fs.Path;
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/fieldname/FieldnameRecordReader.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/fieldname/FieldnameRecordReader.java
similarity index 66%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/fieldname/FieldnameRecordReader.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/fieldname/FieldnameRecordReader.java
index 68d0599..e8d2f74 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/fieldname/FieldnameRecordReader.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/fieldname/FieldnameRecordReader.java
@@ -1,20 +1,23 @@
/*
- * FILE: FieldnameRecordReader
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper.shapefileParser.fieldname;
+
+package org.apache.sedona.core.formatMapper.shapefileParser.fieldname;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream;
@@ -24,8 +27,8 @@ import org.apache.hadoop.mapreduce.InputSplit;
import org.apache.hadoop.mapreduce.RecordReader;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.lib.input.CombineFileSplit;
-import org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.dbf.DbfParseUtil;
-import org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.dbf.FieldDescriptor;
+import org.apache.sedona.core.formatMapper.shapefileParser.parseUtils.dbf.DbfParseUtil;
+import org.apache.sedona.core.formatMapper.shapefileParser.parseUtils.dbf.FieldDescriptor;
import java.io.IOException;
import java.util.List;
@@ -101,13 +104,11 @@ public class FieldnameRecordReader
dbfParser.parseFileHead(inputStream);
String fieldNames = "";
List<FieldDescriptor> fieldDescriptors = dbfParser.getFieldDescriptors();
- for (int i=0;i<fieldDescriptors.size();i++)
- {
- if (i==0)
- {
- fieldNames+=fieldDescriptors.get(i).getFieldName();
+ for (int i = 0; i < fieldDescriptors.size(); i++) {
+ if (i == 0) {
+ fieldNames += fieldDescriptors.get(i).getFieldName();
}
- else {fieldNames+="\t"+fieldDescriptors.get(i).getFieldName();}
+ else {fieldNames += "\t" + fieldDescriptors.get(i).getFieldName();}
}
return fieldNames;
}
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/dbf/DbfParseUtil.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/dbf/DbfParseUtil.java
similarity index 85%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/dbf/DbfParseUtil.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/dbf/DbfParseUtil.java
index 20aeafd..6c5e076 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/dbf/DbfParseUtil.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/dbf/DbfParseUtil.java
@@ -1,24 +1,27 @@
/*
- * FILE: DbfParseUtil
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.dbf;
+
+package org.apache.sedona.core.formatMapper.shapefileParser.parseUtils.dbf;
import org.apache.commons.io.EndianUtils;
import org.apache.hadoop.io.Text;
-import org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp.ShapeFileConst;
+import org.apache.sedona.core.formatMapper.shapefileParser.parseUtils.shp.ShapeFileConst;
import java.io.DataInputStream;
import java.io.IOException;
@@ -44,6 +47,32 @@ public class DbfParseUtil
* number of records already read. Records that is ignored also counted in
*/
public int numRecordRead;
+ /**
+ * fieldDescriptors of current .dbf file
+ */
+ private List<FieldDescriptor> fieldDescriptors = null;
+
+ /**
+ * Copied from org.geotools.data.shapefile.dbf.fastParse
+ * Performs a faster byte[] to String conversion under the assumption the content
+ * is represented with one byte per char
+ *
+ * @param bytes
+ * @param fieldOffset
+ * @param fieldLen
+ * @return
+ */
+ private static String fastParse(final byte[] bytes, final int fieldOffset, final int fieldLen)
+ {
+ // faster reading path, the decoder is for some reason slower,
+ // probably because it has to make extra checks to support multibyte chars
+ final char[] chars = new char[fieldLen];
+ for (int i = 0; i < fieldLen; i++) {
+ // force the byte to a positive integer interpretation before casting to char
+ chars[i] = ((char) (0x00FF & bytes[fieldOffset + i]));
+ }
+ return new String(chars);
+ }
public boolean isDone()
{
@@ -55,16 +84,12 @@ public class DbfParseUtil
return (float) numRecordRead / (float) numRecord;
}
- public List<FieldDescriptor> getFieldDescriptors() {
+ public List<FieldDescriptor> getFieldDescriptors()
+ {
return fieldDescriptors;
}
/**
- * fieldDescriptors of current .dbf file
- */
- private List<FieldDescriptor> fieldDescriptors = null;
-
- /**
* parse header of .dbf file and draw information for next step
*
* @param inputStream
@@ -196,8 +221,8 @@ public class DbfParseUtil
FieldDescriptor descriptor = fieldDescriptors.get(i);
byte[] fldBytes = new byte[descriptor.getFieldLength()];
buffer.get(fldBytes, 0, fldBytes.length);
- String charset = System.getProperty("geospark.global.charset", "default");
- Boolean utf8flag = charset.equalsIgnoreCase("utf8") ? true : false;
+ String charset = System.getProperty("sedona.global.charset", "default");
+ Boolean utf8flag = charset.equalsIgnoreCase("utf8");
byte[] attr = utf8flag ? fldBytes : fastParse(fldBytes, 0, fldBytes.length).trim().getBytes();
if (i > 0) {
attributes.append(delimiter, 0, 1);// first attribute doesn't append '\t'
@@ -206,26 +231,4 @@ public class DbfParseUtil
}
return attributes.toString();
}
-
- /**
- * Copied from org.geotools.data.shapefile.dbf.fastParse
- * Performs a faster byte[] to String conversion under the assumption the content
- * is represented with one byte per char
- *
- * @param bytes
- * @param fieldOffset
- * @param fieldLen
- * @return
- */
- private static String fastParse(final byte[] bytes, final int fieldOffset, final int fieldLen)
- {
- // faster reading path, the decoder is for some reason slower,
- // probably because it has to make extra checks to support multibyte chars
- final char[] chars = new char[fieldLen];
- for (int i = 0; i < fieldLen; i++) {
- // force the byte to a positive integer interpretation before casting to char
- chars[i] = ((char) (0x00FF & bytes[fieldOffset + i]));
- }
- return new String(chars);
- }
}
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/dbf/FieldDescriptor.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/dbf/FieldDescriptor.java
similarity index 69%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/dbf/FieldDescriptor.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/dbf/FieldDescriptor.java
index 11b10a1..fd55e17 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/dbf/FieldDescriptor.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/dbf/FieldDescriptor.java
@@ -1,20 +1,23 @@
/*
- * FILE: FieldDescriptor
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.dbf;
+
+package org.apache.sedona.core.formatMapper.shapefileParser.parseUtils.dbf;
import java.io.Serializable;
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/MultiPointParser.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/MultiPointParser.java
similarity index 53%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/MultiPointParser.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/MultiPointParser.java
index ef1400d..8943c97 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/MultiPointParser.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/MultiPointParser.java
@@ -1,20 +1,23 @@
/*
- * FILE: MultiPointParser
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp;
+
+package org.apache.sedona.core.formatMapper.shapefileParser.parseUtils.shp;
import org.locationtech.jts.geom.CoordinateSequence;
import org.locationtech.jts.geom.Geometry;
@@ -23,8 +26,6 @@ import org.locationtech.jts.geom.MultiPoint;
import java.io.IOException;
-import static org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp.ShapeFileConst.DOUBLE_LENGTH;
-
public class MultiPointParser
extends ShapeParser
{
@@ -49,7 +50,7 @@ public class MultiPointParser
@Override
public Geometry parseShape(ShapeReader reader)
{
- reader.skip(4 * DOUBLE_LENGTH);
+ reader.skip(4 * ShapeFileConst.DOUBLE_LENGTH);
int numPoints = reader.readInt();
CoordinateSequence coordinateSequence = readCoordinates(reader, numPoints);
MultiPoint multiPoint = geometryFactory.createMultiPoint(coordinateSequence);
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/PointParser.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/PointParser.java
similarity index 53%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/PointParser.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/PointParser.java
index ac265f7..0b8fcfc 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/PointParser.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/PointParser.java
@@ -1,20 +1,23 @@
/*
- * FILE: PointParser
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp;
+
+package org.apache.sedona.core.formatMapper.shapefileParser.parseUtils.shp;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Geometry;
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/PolyLineParser.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/PolyLineParser.java
similarity index 60%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/PolyLineParser.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/PolyLineParser.java
index 4dacd49..1d13bd5 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/PolyLineParser.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/PolyLineParser.java
@@ -1,20 +1,23 @@
/*
- * FILE: PolyLineParser
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp;
+
+package org.apache.sedona.core.formatMapper.shapefileParser.parseUtils.shp;
import org.locationtech.jts.geom.CoordinateSequence;
import org.locationtech.jts.geom.Geometry;
@@ -23,8 +26,6 @@ import org.locationtech.jts.geom.LineString;
import java.io.IOException;
-import static org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp.ShapeFileConst.DOUBLE_LENGTH;
-
public class PolyLineParser
extends ShapeParser
{
@@ -49,7 +50,7 @@ public class PolyLineParser
@Override
public Geometry parseShape(ShapeReader reader)
{
- reader.skip(4 * DOUBLE_LENGTH);
+ reader.skip(4 * ShapeFileConst.DOUBLE_LENGTH);
int numParts = reader.readInt();
int numPoints = reader.readInt();
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/PolygonParser.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/PolygonParser.java
similarity index 74%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/PolygonParser.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/PolygonParser.java
index c808120..9da598f 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/PolygonParser.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/PolygonParser.java
@@ -1,34 +1,35 @@
/*
- * FILE: PolygonParser
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp;
+package org.apache.sedona.core.formatMapper.shapefileParser.parseUtils.shp;
+
+import org.geotools.geometry.jts.coordinatesequence.CoordinateSequences;
import org.locationtech.jts.geom.CoordinateSequence;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.LinearRing;
import org.locationtech.jts.geom.Polygon;
-import org.geotools.geometry.jts.coordinatesequence.CoordinateSequences;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import static org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp.ShapeFileConst.DOUBLE_LENGTH;
-
public class PolygonParser
extends ShapeParser
{
@@ -53,7 +54,7 @@ public class PolygonParser
@Override
public Geometry parseShape(ShapeReader reader)
{
- reader.skip(4 * DOUBLE_LENGTH);
+ reader.skip(4 * ShapeFileConst.DOUBLE_LENGTH);
int numRings = reader.readInt();
int numPoints = reader.readInt();
diff --git a/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/ShapeFileConst.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/ShapeFileConst.java
new file mode 100644
index 0000000..639f4e9
--- /dev/null
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/ShapeFileConst.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.formatMapper.shapefileParser.parseUtils.shp;
+
+// TODO: Auto-generated Javadoc
+
+/**
+ * The Interface ShapeFileConst.
+ */
+public interface ShapeFileConst
+{
+
+ /**
+ * Consts for .shp file
+ */
+ int EXPECT_FILE_CODE = 9994;
+
+ /**
+ * The Constant EXPECT_FILE_VERSION.
+ */
+ int EXPECT_FILE_VERSION = 1000;
+
+ /**
+ * The Constant HEAD_FILE_LENGTH_16BIT.
+ */
+ int HEAD_FILE_LENGTH_16BIT = 50;
+
+ /**
+ * The Constant HEAD_EMPTY_NUM.
+ */
+ int HEAD_EMPTY_NUM = 5;
+
+ /**
+ * The Constant HEAD_BOX_NUM.
+ */
+ int HEAD_BOX_NUM = 8;
+
+ /**
+ * The Constant INT_LENGTH.
+ */
+ int INT_LENGTH = 4;
+
+ /**
+ * The Constant DOUBLE_LENGTH.
+ */
+ int DOUBLE_LENGTH = 8;
+
+ /**
+ * Consts for .dbf file
+ */
+ byte FIELD_DESCRIPTOR_TERMINATOR = 0x0d;
+
+ /**
+ * The Constant FIELD_NAME_LENGTH.
+ */
+ byte FIELD_NAME_LENGTH = 11;
+
+ /**
+ * The Constant RECORD_DELETE_FLAG.
+ */
+ byte RECORD_DELETE_FLAG = 0x2A;
+
+ /**
+ * The Constant FILE_END_FLAG.
+ */
+ byte FILE_END_FLAG = 0x1A;
+
+ /**
+ * The Constant RECORD_EXIST_FLAG.
+ */
+ byte RECORD_EXIST_FLAG = 0x20;
+}
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/ShapeParser.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/ShapeParser.java
similarity index 68%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/ShapeParser.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/ShapeParser.java
index 436c718..163fdc5 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/ShapeParser.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/ShapeParser.java
@@ -1,20 +1,23 @@
/*
- * FILE: ShapeParser
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp;
+
+package org.apache.sedona.core.formatMapper.shapefileParser.parseUtils.shp;
import org.locationtech.jts.geom.CoordinateSequence;
import org.locationtech.jts.geom.Geometry;
diff --git a/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/ShapeReader.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/ShapeReader.java
new file mode 100644
index 0000000..0eaab84
--- /dev/null
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/ShapeReader.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.formatMapper.shapefileParser.parseUtils.shp;
+
+public interface ShapeReader
+{
+
+ int readInt();
+
+ double readDouble();
+
+ byte readByte();
+
+ void skip(int numBytes);
+}
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/ShapeReaderFactory.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/ShapeReaderFactory.java
similarity index 67%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/ShapeReaderFactory.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/ShapeReaderFactory.java
index 5f5d057..fe1959a 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/ShapeReaderFactory.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/ShapeReaderFactory.java
@@ -1,21 +1,23 @@
/*
- * FILE: ShapeReaderFactory
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp;
+package org.apache.sedona.core.formatMapper.shapefileParser.parseUtils.shp;
import com.esotericsoftware.kryo.io.Input;
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/ShapeSerde.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/ShapeSerde.java
similarity index 84%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/ShapeSerde.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/ShapeSerde.java
index c7c607d..0d0ffcc 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/ShapeSerde.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/ShapeSerde.java
@@ -1,21 +1,23 @@
/*
- * FILE: ShapeSerde
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp;
+package org.apache.sedona.core.formatMapper.shapefileParser.parseUtils.shp;
import com.esotericsoftware.kryo.io.Input;
import org.locationtech.jts.geom.Geometry;
@@ -30,9 +32,6 @@ import org.locationtech.jts.geom.Polygon;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
-import static org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp.ShapeFileConst.DOUBLE_LENGTH;
-import static org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp.ShapeFileConst.INT_LENGTH;
-
/**
* Provides methods to efficiently serialize and deserialize geometry types
* using shapefile format developed by ESRI. Does not serialize user data
@@ -58,6 +57,8 @@ import static org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.sh
*/
public class ShapeSerde
{
+ private static final int POINT_LENGTH = 1 + 2 * ShapeFileConst.DOUBLE_LENGTH;
+
public static byte[] serialize(Geometry geometry)
{
if (geometry instanceof Point) {
@@ -104,8 +105,6 @@ public class ShapeSerde
return parser.parseShape(reader);
}
- private static final int POINT_LENGTH = 1 + 2 * DOUBLE_LENGTH;
-
private static byte[] serialize(Point point)
{
ByteBuffer buffer = newBuffer(POINT_LENGTH);
@@ -127,7 +126,7 @@ public class ShapeSerde
ByteBuffer buffer = newBuffer(calculateBufferSize(multiPoint));
putType(buffer, ShapeType.MULTIPOINT);
- buffer.position(buffer.position() + 4 * DOUBLE_LENGTH);
+ buffer.position(buffer.position() + 4 * ShapeFileConst.DOUBLE_LENGTH);
buffer.putInt(numPoints);
for (int i = 0; i < numPoints; i++) {
Point point = (Point) multiPoint.getGeometryN(i);
@@ -139,7 +138,7 @@ public class ShapeSerde
private static int calculateBufferSize(MultiPoint multiPoint)
{
- return 1 + 4 * DOUBLE_LENGTH + INT_LENGTH + multiPoint.getNumPoints() * 2 * DOUBLE_LENGTH;
+ return 1 + 4 * ShapeFileConst.DOUBLE_LENGTH + ShapeFileConst.INT_LENGTH + multiPoint.getNumPoints() * 2 * ShapeFileConst.DOUBLE_LENGTH;
}
private static byte[] serialize(LineString lineString)
@@ -155,13 +154,13 @@ public class ShapeSerde
private static int calculateBufferSize(int numPoints, int numParts)
{
- return 1 + 4 * DOUBLE_LENGTH + INT_LENGTH + INT_LENGTH + numParts * INT_LENGTH + numPoints * 2 * DOUBLE_LENGTH;
+ return 1 + 4 * ShapeFileConst.DOUBLE_LENGTH + ShapeFileConst.INT_LENGTH + ShapeFileConst.INT_LENGTH + numParts * ShapeFileConst.INT_LENGTH + numPoints * 2 * ShapeFileConst.DOUBLE_LENGTH;
}
private static void putHeader(ByteBuffer buffer, ShapeType type, int numPoints, int numParts)
{
putType(buffer, type);
- buffer.position(buffer.position() + 4 * DOUBLE_LENGTH);
+ buffer.position(buffer.position() + 4 * ShapeFileConst.DOUBLE_LENGTH);
buffer.putInt(numParts);
buffer.putInt(numPoints);
}
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/ShapeType.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/ShapeType.java
similarity index 66%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/ShapeType.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/ShapeType.java
index f3f1c7a..3b32744 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/ShapeType.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/ShapeType.java
@@ -1,20 +1,23 @@
/*
- * FILE: ShapeType
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp;
+
+package org.apache.sedona.core.formatMapper.shapefileParser.parseUtils.shp;
import org.locationtech.jts.geom.GeometryFactory;
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/ShpFileParser.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/ShpFileParser.java
similarity index 80%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/ShpFileParser.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/ShpFileParser.java
index 7d25fb9..41aaa19 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/ShpFileParser.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/ShpFileParser.java
@@ -1,24 +1,27 @@
/*
- * FILE: ShpFileParser
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp;
+
+package org.apache.sedona.core.formatMapper.shapefileParser.parseUtils.shp;
import org.apache.commons.io.EndianUtils;
import org.apache.hadoop.fs.FSDataInputStream;
-import org.datasyslab.geospark.formatMapper.shapefileParser.shapes.ShpRecord;
+import org.apache.sedona.core.formatMapper.shapefileParser.shapes.ShpRecord;
import java.io.IOException;
import java.io.Serializable;
@@ -29,55 +32,19 @@ public class ShpFileParser
{
/**
+ * input reader
+ */
+ private final SafeReader reader;
+ /**
* lenth of file in bytes
*/
private long fileLength = 0;
-
/**
* remain length of bytes to parse
*/
private long remainLength = 0;
/**
- * input reader
- */
- private final SafeReader reader;
-
- /**
- * A limited wrapper around FSDataInputStream providing proper implementations
- * for methods of FSDataInputStream which are known to be broken on some platforms.
- */
- private static final class SafeReader
- {
- private final FSDataInputStream input;
-
- private SafeReader(FSDataInputStream input)
- {
- this.input = input;
- }
-
- public int readInt()
- throws IOException
- {
- byte[] bytes = new byte[ShapeFileConst.INT_LENGTH];
- input.readFully(bytes);
- return ByteBuffer.wrap(bytes).getInt();
- }
-
- public void skip(int numBytes)
- throws IOException
- {
- input.skip(numBytes);
- }
-
- public void read(byte[] buffer, int offset, int length)
- throws IOException
- {
- input.readFully(buffer, offset, length);
- }
- }
-
- /**
* create a new shape file parser with a input source that is instance of DataInputStream
*
* @param inputStream
@@ -164,4 +131,38 @@ public class ShpFileParser
{
return 1 - (float) remainLength / (float) fileLength;
}
+
+ /**
+ * A limited wrapper around FSDataInputStream providing proper implementations
+ * for methods of FSDataInputStream which are known to be broken on some platforms.
+ */
+ private static final class SafeReader
+ {
+ private final FSDataInputStream input;
+
+ private SafeReader(FSDataInputStream input)
+ {
+ this.input = input;
+ }
+
+ public int readInt()
+ throws IOException
+ {
+ byte[] bytes = new byte[INT_LENGTH];
+ input.readFully(bytes);
+ return ByteBuffer.wrap(bytes).getInt();
+ }
+
+ public void skip(int numBytes)
+ throws IOException
+ {
+ input.skip(numBytes);
+ }
+
+ public void read(byte[] buffer, int offset, int length)
+ throws IOException
+ {
+ input.readFully(buffer, offset, length);
+ }
+ }
}
diff --git a/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/TypeUnknownException.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/TypeUnknownException.java
new file mode 100644
index 0000000..45f854f
--- /dev/null
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/parseUtils/shp/TypeUnknownException.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.formatMapper.shapefileParser.parseUtils.shp;
+
+// TODO: Auto-generated Javadoc
+
+/**
+ * The Class TypeUnknownException.
+ */
+public class TypeUnknownException
+ extends RuntimeException
+{
+
+ /**
+ * create an exception indicates that the shape type number we get from .shp file is valid
+ *
+ * @param typeID the type ID
+ */
+ public TypeUnknownException(int typeID)
+ {
+ super("Unknown shape type " + typeID);
+ }
+}
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/shapes/CombineShapeReader.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/CombineShapeReader.java
similarity index 86%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/shapes/CombineShapeReader.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/CombineShapeReader.java
index 57b2704..fca1fbd 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/shapes/CombineShapeReader.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/CombineShapeReader.java
@@ -1,20 +1,23 @@
/*
- * FILE: CombineShapeReader
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper.shapefileParser.shapes;
+
+package org.apache.sedona.core.formatMapper.shapefileParser.shapes;
import org.apache.commons.io.FilenameUtils;
import org.apache.hadoop.fs.FSDataInputStream;
@@ -26,7 +29,7 @@ import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.lib.input.CombineFileSplit;
import org.apache.hadoop.mapreduce.lib.input.FileSplit;
import org.apache.log4j.Logger;
-import org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp.ShapeType;
+import org.apache.sedona.core.formatMapper.shapefileParser.parseUtils.shp.ShapeType;
import java.io.IOException;
import java.nio.ByteBuffer;
@@ -37,61 +40,51 @@ public class CombineShapeReader
{
/**
+ * dubug logger
+ */
+ final static Logger logger = Logger.getLogger(CombineShapeReader.class);
+ /**
+ * suffix of attribute file
+ */
+ private final static String DBF_SUFFIX = "dbf";
+ /**
+ * suffix of shape record file
+ */
+ private final static String SHP_SUFFIX = "shp";
+ /**
+ * suffix of index file
+ */
+ private final static String SHX_SUFFIX = "shx";
+ /**
* id of input path of .shp file
*/
private FileSplit shpSplit = null;
-
/**
* id of input path of .shx file
*/
private FileSplit shxSplit = null;
-
/**
* id of input path of .dbf file
*/
private FileSplit dbfSplit = null;
-
/**
* RecordReader for .shp file
*/
private ShapeFileReader shapeFileReader = null;
-
/**
* RecordReader for .dbf file
*/
private DbfFileReader dbfFileReader = null;
-
- /**
- * suffix of attribute file
- */
- private final static String DBF_SUFFIX = "dbf";
-
- /**
- * suffix of shape record file
- */
- private final static String SHP_SUFFIX = "shp";
-
- /**
- * suffix of index file
- */
- private final static String SHX_SUFFIX = "shx";
-
/**
* flag of whether .dbf exists
*/
private boolean hasDbf = false;
-
/**
* flag of whether having next .dbf record
*/
private boolean hasNextDbf = false;
/**
- * dubug logger
- */
- final static Logger logger = Logger.getLogger(CombineShapeReader.class);
-
- /**
* cut the combined split into FileSplit for .shp, .shx and .dbf
*
* @param split
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/shapes/DbfFileReader.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/DbfFileReader.java
similarity index 69%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/shapes/DbfFileReader.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/DbfFileReader.java
index fec848a..ae9af1f 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/shapes/DbfFileReader.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/DbfFileReader.java
@@ -1,20 +1,23 @@
/*
- * FILE: DbfFileReader
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper.shapefileParser.shapes;
+
+package org.apache.sedona.core.formatMapper.shapefileParser.shapes;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FileSystem;
@@ -22,7 +25,7 @@ import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapreduce.InputSplit;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.lib.input.FileSplit;
-import org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.dbf.DbfParseUtil;
+import org.apache.sedona.core.formatMapper.shapefileParser.parseUtils.dbf.DbfParseUtil;
import java.io.IOException;
@@ -31,30 +34,26 @@ public class DbfFileReader
{
/**
+ * Dbf parser
+ */
+ DbfParseUtil dbfParser = null;
+ /**
* inputstream of .dbf file
*/
private FSDataInputStream inputStream = null;
-
/**
* primitive bytes array of one row
*/
private String value = null;
-
/**
* key value of current row
*/
private ShapeKey key = null;
-
/**
* generated id of current row
*/
private int id = 0;
- /**
- * Dbf parser
- */
- DbfParseUtil dbfParser = null;
-
public void initialize(InputSplit split, TaskAttemptContext context)
throws IOException, InterruptedException
{
@@ -76,7 +75,7 @@ public class DbfFileReader
return false;
}
else {
- value = new String(curbytes);
+ value = curbytes;
key = new ShapeKey();
key.setIndex(id++);
return true;
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/shapes/PrimitiveShape.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/PrimitiveShape.java
similarity index 54%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/shapes/PrimitiveShape.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/PrimitiveShape.java
index ef83347..5b5f381 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/shapes/PrimitiveShape.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/PrimitiveShape.java
@@ -1,27 +1,30 @@
/*
- * FILE: PrimitiveShape
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper.shapefileParser.shapes;
+package org.apache.sedona.core.formatMapper.shapefileParser.shapes;
+
+import org.apache.sedona.core.formatMapper.shapefileParser.parseUtils.shp.ShapeParser;
+import org.apache.sedona.core.formatMapper.shapefileParser.parseUtils.shp.ShapeReaderFactory;
+import org.apache.sedona.core.formatMapper.shapefileParser.parseUtils.shp.ShapeType;
+import org.apache.sedona.core.formatMapper.shapefileParser.parseUtils.shp.TypeUnknownException;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.GeometryFactory;
-import org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp.ShapeParser;
-import org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp.ShapeReaderFactory;
-import org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp.ShapeType;
-import org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp.TypeUnknownException;
import java.io.IOException;
import java.io.Serializable;
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/shapes/ShapeFileReader.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/ShapeFileReader.java
similarity index 78%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/shapes/ShapeFileReader.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/ShapeFileReader.java
index dde6ff7..300ca4f 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/shapes/ShapeFileReader.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/ShapeFileReader.java
@@ -1,20 +1,23 @@
/*
- * FILE: ShapeFileReader
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper.shapefileParser.shapes;
+
+package org.apache.sedona.core.formatMapper.shapefileParser.shapes;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FileSystem;
@@ -23,7 +26,7 @@ import org.apache.hadoop.mapreduce.InputSplit;
import org.apache.hadoop.mapreduce.RecordReader;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.lib.input.FileSplit;
-import org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp.ShpFileParser;
+import org.apache.sedona.core.formatMapper.shapefileParser.parseUtils.shp.ShpFileParser;
import java.io.IOException;
@@ -32,25 +35,21 @@ public class ShapeFileReader
{
/**
+ * file parser
+ */
+ ShpFileParser parser = null;
+ /**
* record id
*/
private ShapeKey recordKey = null;
-
/**
* primitive bytes value
*/
private ShpRecord recordContent = null;
-
/**
* inputstream for .shp file
*/
private FSDataInputStream shpInputStream = null;
-
- /**
- * file parser
- */
- ShpFileParser parser = null;
-
/**
* Iterator of indexes of records
*/
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/shapes/ShapeInputFormat.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/ShapeInputFormat.java
similarity index 69%
rename from core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/shapes/ShapeInputFormat.java
rename to core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/ShapeInputFormat.java
index d384d77..51c340b 100644
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/shapes/ShapeInputFormat.java
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/ShapeInputFormat.java
@@ -1,20 +1,23 @@
/*
- * FILE: ShapeInputFormat
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.formatMapper.shapefileParser.shapes;
+
+package org.apache.sedona.core.formatMapper.shapefileParser.shapes;
import com.google.common.primitives.Longs;
import org.apache.commons.io.FilenameUtils;
@@ -27,7 +30,10 @@ import org.apache.hadoop.mapreduce.lib.input.CombineFileInputFormat;
import org.apache.hadoop.mapreduce.lib.input.CombineFileSplit;
import java.io.IOException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
public class ShapeInputFormat
extends CombineFileInputFormat<ShapeKey, PrimitiveShape>
@@ -67,10 +73,10 @@ public class ShapeInputFormat
long[] fileSizes = combineChildPathFileSplit.getLengths();
// sort by Path name and size using TreeMap
- Map<Path,Long> filePathSizePair = new TreeMap<Path,Long>();
+ Map<Path, Long> filePathSizePair = new TreeMap<Path, Long>();
int i = 0;
- while(i < filePaths.length){
- filePathSizePair.put(filePaths[i],fileSizes[i]);
+ while (i < filePaths.length) {
+ filePathSizePair.put(filePaths[i], fileSizes[i]);
i++;
}
@@ -78,13 +84,13 @@ public class ShapeInputFormat
List<Long> fileSplitSizeParts = new ArrayList<>();
String prevfilename = "";
- for (Path filePath:filePathSizePair.keySet()) {
+ for (Path filePath : filePathSizePair.keySet()) {
String filename = FilenameUtils.removeExtension(filePath.getName()).toLowerCase();
fileSplitPathParts.add(filePath);
fileSplitSizeParts.add(filePathSizePair.get(filePath));
if (prevfilename != "" && !prevfilename.equals(filename)) {
- // compare file name and if it is different then all same filename is into CombileFileSplit
+ // compare file name and if it is different then all same filename is into CombileFileSplit
splits.add(new CombineFileSplit(fileSplitPathParts.toArray(new Path[0]), Longs.toArray(fileSplitSizeParts)));
fileSplitPathParts.clear();
fileSplitSizeParts.clear();
diff --git a/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/ShapeKey.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/ShapeKey.java
new file mode 100644
index 0000000..90f6e5a
--- /dev/null
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/ShapeKey.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.formatMapper.shapefileParser.shapes;
+
+import java.io.DataOutput;
+import java.io.IOException;
+import java.io.Serializable;
+
+public class ShapeKey
+ implements Serializable
+{
+
+ /**
+ * record id
+ */
+ Long index = 0l;
+
+ public void write(DataOutput dataOutput)
+ throws IOException
+ {
+ dataOutput.writeLong(index);
+ }
+
+ public long getIndex()
+ {
+ return index;
+ }
+
+ public void setIndex(long _index)
+ {
+ index = _index;
+ }
+}
diff --git a/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/ShpRecord.java b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/ShpRecord.java
new file mode 100644
index 0000000..65a2a6b
--- /dev/null
+++ b/core/src/main/java/org/apache/sedona/core/formatMapper/shapefileParser/shapes/ShpRecord.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.formatMapper.shapefileParser.shapes;
+
+import org.apache.hadoop.io.BytesWritable;
+
+import java.io.Serializable;
+
+public class ShpRecord
+ implements Serializable
+{
+
+ /**
+ * primitive byte contents
+ */
+ private BytesWritable bytes = null;
+
+ /**
+ * shape type
+ */
+ private int typeID = -1;
+
+ /**
+ * create a ShpRecord with primitive bytes and shape type id we abstract from .shp file
+ *
+ * @param byteArray
+ * @param shapeTypeID
+ */
+ public ShpRecord(byte[] byteArray, int shapeTypeID)
+ {
+ bytes = new BytesWritable();
+ bytes.set(byteArray, 0, byteArray.length);
+ typeID = shapeTypeID;
+ }
+
+ public BytesWritable getBytes()
+ {
+ return bytes;
+ }
+
+ public int getTypeID()
+ {
+ return typeID;
+ }
+}
diff --git a/core/src/main/java/org/datasyslab/geospark/geometryObjects/Circle.java b/core/src/main/java/org/apache/sedona/core/geometryObjects/Circle.java
similarity index 93%
rename from core/src/main/java/org/datasyslab/geospark/geometryObjects/Circle.java
rename to core/src/main/java/org/apache/sedona/core/geometryObjects/Circle.java
index f5cf610..961a5d5 100644
--- a/core/src/main/java/org/datasyslab/geospark/geometryObjects/Circle.java
+++ b/core/src/main/java/org/apache/sedona/core/geometryObjects/Circle.java
@@ -1,20 +1,23 @@
/*
- * FILE: Circle
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.geometryObjects;
+
+package org.apache.sedona.core.geometryObjects;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.CoordinateFilter;
@@ -42,28 +45,15 @@ public class Circle
/**
* The center.
*/
- private Geometry centerGeometry;
-
- /**
- * Gets the center geometry.
- *
- * @return the center geometry
- */
- public Geometry getCenterGeometry()
- {
- return centerGeometry;
- }
-
+ private final Geometry centerGeometry;
/**
* The center point.
*/
- private Coordinate centerPoint;
-
+ private final Coordinate centerPoint;
/**
* The radius.
*/
private Double radius;
-
/**
* The mbr.
*/
@@ -92,6 +82,16 @@ public class Circle
}
/**
+ * Gets the center geometry.
+ *
+ * @return the center geometry
+ */
+ public Geometry getCenterGeometry()
+ {
+ return centerGeometry;
+ }
+
+ /**
* Gets the center point.
*
* @return the center point
@@ -392,7 +392,7 @@ public class Circle
public boolean equalsExact(Geometry g, double tolerance)
{
String type1 = this.getGeometryType();
- String type2 = ((Geometry) g).getGeometryType();
+ String type2 = g.getGeometryType();
double radius1 = this.radius;
double radius2 = ((Circle) g).radius;
diff --git a/core/src/main/java/org/datasyslab/geospark/geometryObjects/GeometrySerde.java b/core/src/main/java/org/apache/sedona/core/geometryObjects/GeometrySerde.java
similarity index 87%
rename from core/src/main/java/org/datasyslab/geospark/geometryObjects/GeometrySerde.java
rename to core/src/main/java/org/apache/sedona/core/geometryObjects/GeometrySerde.java
index 73cfef7..213e8f2 100755
--- a/core/src/main/java/org/datasyslab/geospark/geometryObjects/GeometrySerde.java
+++ b/core/src/main/java/org/apache/sedona/core/geometryObjects/GeometrySerde.java
@@ -1,27 +1,31 @@
/*
- * FILE: GeometrySerde
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.geometryObjects;
+package org.apache.sedona.core.geometryObjects;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.Registration;
import com.esotericsoftware.kryo.Serializer;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
+import org.apache.log4j.Logger;
+import org.apache.sedona.core.formatMapper.shapefileParser.parseUtils.shp.ShapeSerde;
import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.GeometryCollection;
@@ -32,8 +36,6 @@ import org.locationtech.jts.geom.MultiPoint;
import org.locationtech.jts.geom.MultiPolygon;
import org.locationtech.jts.geom.Point;
import org.locationtech.jts.geom.Polygon;
-import org.apache.log4j.Logger;
-import org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp.ShapeSerde;
/**
* Provides methods to efficiently serialize and deserialize geometry types.
@@ -51,32 +53,6 @@ public class GeometrySerde
private static final Logger log = Logger.getLogger(GeometrySerde.class);
private static final GeometryFactory geometryFactory = new GeometryFactory();
- private enum Type
- {
- SHAPE(0),
- CIRCLE(1),
- GEOMETRYCOLLECTION(2),
- ENVELOPE(3);
-
- private final int id;
-
- Type(int id)
- {
- this.id = id;
- }
-
- public static Type fromId(int id)
- {
- for (Type type : values()) {
- if (type.id == id) {
- return type;
- }
- }
-
- return null;
- }
- }
-
@Override
public void write(Kryo kryo, Output out, Object object)
{
@@ -193,4 +169,30 @@ public class GeometrySerde
geometry.setUserData(readUserData(kryo, input));
return geometry;
}
+
+ private enum Type
+ {
+ SHAPE(0),
+ CIRCLE(1),
+ GEOMETRYCOLLECTION(2),
+ ENVELOPE(3);
+
+ private final int id;
+
+ Type(int id)
+ {
+ this.id = id;
+ }
+
+ public static Type fromId(int id)
+ {
+ for (Type type : values()) {
+ if (type.id == id) {
+ return type;
+ }
+ }
+
+ return null;
+ }
+ }
}
diff --git a/core/src/main/java/org/datasyslab/geospark/geometryObjects/SpatialIndexSerde.java b/core/src/main/java/org/apache/sedona/core/geometryObjects/SpatialIndexSerde.java
similarity index 91%
rename from core/src/main/java/org/datasyslab/geospark/geometryObjects/SpatialIndexSerde.java
rename to core/src/main/java/org/apache/sedona/core/geometryObjects/SpatialIndexSerde.java
index 3171fe3..261867c 100644
--- a/core/src/main/java/org/datasyslab/geospark/geometryObjects/SpatialIndexSerde.java
+++ b/core/src/main/java/org/apache/sedona/core/geometryObjects/SpatialIndexSerde.java
@@ -1,26 +1,29 @@
/*
- * FILE: SpatialIndexSerde
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.geometryObjects;
+package org.apache.sedona.core.geometryObjects;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.Serializer;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
+import org.apache.log4j.Logger;
import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.index.quadtree.Node;
@@ -28,7 +31,6 @@ import org.locationtech.jts.index.quadtree.Quadtree;
import org.locationtech.jts.index.strtree.AbstractNode;
import org.locationtech.jts.index.strtree.ItemBoundable;
import org.locationtech.jts.index.strtree.STRtree;
-import org.apache.log4j.Logger;
import java.util.ArrayList;
import java.util.List;
@@ -46,7 +48,7 @@ public class SpatialIndexSerde
private static final Logger log = Logger.getLogger(SpatialIndexSerde.class);
- private GeometrySerde geometrySerde;
+ private final GeometrySerde geometrySerde;
public SpatialIndexSerde()
{
@@ -60,31 +62,6 @@ public class SpatialIndexSerde
this.geometrySerde = geometrySerde;
}
- private enum Type
- {
-
- QUADTREE(0),
- RTREE(1);
-
- private final int id;
-
- Type(int id)
- {
- this.id = id;
- }
-
- public static Type fromId(int id)
- {
- for (Type type : values()) {
- if (type.id == id) {
- return type;
- }
- }
-
- return null;
- }
- }
-
@Override
public void write(Kryo kryo, Output output, Object o)
{
@@ -309,4 +286,29 @@ public class SpatialIndexSerde
{
output.writeByte((byte) type.id);
}
+
+ private enum Type
+ {
+
+ QUADTREE(0),
+ RTREE(1);
+
+ private final int id;
+
+ Type(int id)
+ {
+ this.id = id;
+ }
+
+ public static Type fromId(int id)
+ {
+ for (Type type : values()) {
+ if (type.id == id) {
+ return type;
+ }
+ }
+
+ return null;
+ }
+ }
}
diff --git a/core/src/main/java/org/apache/sedona/core/joinJudgement/DedupParams.java b/core/src/main/java/org/apache/sedona/core/joinJudgement/DedupParams.java
new file mode 100644
index 0000000..b0f34ff
--- /dev/null
+++ b/core/src/main/java/org/apache/sedona/core/joinJudgement/DedupParams.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.joinJudgement;
+
+import org.locationtech.jts.geom.Envelope;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * Contains information necessary to activate de-dup logic in sub-classes of {@link JudgementBase}.
+ */
+public final class DedupParams
+ implements Serializable
+{
+ private final List<Envelope> partitionExtents;
+
+ /**
+ * @param partitionExtents A list of partition extents in such an order that
+ * an index of an element in this list matches partition ID.
+ */
+ public DedupParams(List<Envelope> partitionExtents)
+ {
+ this.partitionExtents = Objects.requireNonNull(partitionExtents, "partitionExtents");
+ }
+
+ public List<Envelope> getPartitionExtents()
+ {
+ return partitionExtents;
+ }
+}
diff --git a/core/src/main/java/org/datasyslab/geospark/joinJudgement/DynamicIndexLookupJudgement.java b/core/src/main/java/org/apache/sedona/core/joinJudgement/DynamicIndexLookupJudgement.java
similarity index 83%
rename from core/src/main/java/org/datasyslab/geospark/joinJudgement/DynamicIndexLookupJudgement.java
rename to core/src/main/java/org/apache/sedona/core/joinJudgement/DynamicIndexLookupJudgement.java
index fea2c30..c1fbcf5 100644
--- a/core/src/main/java/org/datasyslab/geospark/joinJudgement/DynamicIndexLookupJudgement.java
+++ b/core/src/main/java/org/apache/sedona/core/joinJudgement/DynamicIndexLookupJudgement.java
@@ -1,35 +1,39 @@
/*
- * FILE: DynamicIndexLookupJudgement
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.joinJudgement;
-import org.locationtech.jts.geom.Envelope;
-import org.locationtech.jts.geom.Geometry;
-import org.locationtech.jts.index.SpatialIndex;
-import org.locationtech.jts.index.quadtree.Quadtree;
-import org.locationtech.jts.index.strtree.STRtree;
+package org.apache.sedona.core.joinJudgement;
+
import org.apache.commons.lang3.tuple.Pair;
import org.apache.log4j.Level;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
+import org.apache.sedona.core.enums.IndexType;
+import org.apache.sedona.core.enums.JoinBuildSide;
+import org.apache.sedona.core.monitoring.Metric;
+import org.apache.sedona.core.utils.TimeUtils;
import org.apache.spark.TaskContext;
import org.apache.spark.api.java.function.FlatMapFunction2;
-import org.datasyslab.geospark.enums.IndexType;
-import org.datasyslab.geospark.enums.JoinBuildSide;
-import org.datasyslab.geospark.monitoring.GeoSparkMetric;
+import org.locationtech.jts.geom.Envelope;
+import org.locationtech.jts.geom.Geometry;
+import org.locationtech.jts.index.SpatialIndex;
+import org.locationtech.jts.index.quadtree.Quadtree;
+import org.locationtech.jts.index.strtree.STRtree;
import javax.annotation.Nullable;
@@ -40,8 +44,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
-import static org.datasyslab.geospark.utils.TimeUtils.elapsedSince;
-
public class DynamicIndexLookupJudgement<T extends Geometry, U extends Geometry>
extends JudgementBase
implements FlatMapFunction2<Iterator<U>, Iterator<T>, Pair<U, T>>, Serializable
@@ -51,10 +53,10 @@ public class DynamicIndexLookupJudgement<T extends Geometry, U extends Geometry>
private final IndexType indexType;
private final JoinBuildSide joinBuildSide;
- private final GeoSparkMetric buildCount;
- private final GeoSparkMetric streamCount;
- private final GeoSparkMetric resultCount;
- private final GeoSparkMetric candidateCount;
+ private final Metric buildCount;
+ private final Metric streamCount;
+ private final Metric resultCount;
+ private final Metric candidateCount;
/**
* @see JudgementBase
@@ -63,10 +65,10 @@ public class DynamicIndexLookupJudgement<T extends Geometry, U extends Geometry>
IndexType indexType,
JoinBuildSide joinBuildSide,
@Nullable DedupParams dedupParams,
- GeoSparkMetric buildCount,
- GeoSparkMetric streamCount,
- GeoSparkMetric resultCount,
- GeoSparkMetric candidateCount)
+ Metric buildCount,
+ Metric streamCount,
+ Metric resultCount,
+ Metric candidateCount)
{
super(considerBoundaryIntersection, dedupParams);
this.indexType = indexType;
@@ -208,7 +210,7 @@ public class DynamicIndexLookupJudgement<T extends Geometry, U extends Geometry>
count++;
}
index.query(new Envelope(0.0, 0.0, 0.0, 0.0));
- log("Loaded %d shapes into an index in %d ms", count, elapsedSince(startTime));
+ log("Loaded %d shapes into an index in %d ms", count, TimeUtils.elapsedSince(startTime));
buildCount.add((int) count);
return index;
}
diff --git a/core/src/main/java/org/datasyslab/geospark/joinJudgement/JudgementBase.java b/core/src/main/java/org/apache/sedona/core/joinJudgement/JudgementBase.java
similarity index 83%
rename from core/src/main/java/org/datasyslab/geospark/joinJudgement/JudgementBase.java
rename to core/src/main/java/org/apache/sedona/core/joinJudgement/JudgementBase.java
index 251a93b..0b73bfd 100644
--- a/core/src/main/java/org/datasyslab/geospark/joinJudgement/JudgementBase.java
+++ b/core/src/main/java/org/apache/sedona/core/joinJudgement/JudgementBase.java
@@ -1,30 +1,33 @@
/*
- * FILE: JudgementBase
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.joinJudgement;
+package org.apache.sedona.core.joinJudgement;
+
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
+import org.apache.sedona.core.utils.HalfOpenRectangle;
+import org.apache.spark.TaskContext;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.Point;
-import org.apache.log4j.LogManager;
-import org.apache.log4j.Logger;
-import org.apache.spark.TaskContext;
-import org.datasyslab.geospark.utils.HalfOpenRectangle;
import javax.annotation.Nullable;
diff --git a/core/src/main/java/org/datasyslab/geospark/joinJudgement/LeftIndexLookupJudgement.java b/core/src/main/java/org/apache/sedona/core/joinJudgement/LeftIndexLookupJudgement.java
similarity index 67%
rename from core/src/main/java/org/datasyslab/geospark/joinJudgement/LeftIndexLookupJudgement.java
rename to core/src/main/java/org/apache/sedona/core/joinJudgement/LeftIndexLookupJudgement.java
index 29658f5..ca23696 100644
--- a/core/src/main/java/org/datasyslab/geospark/joinJudgement/LeftIndexLookupJudgement.java
+++ b/core/src/main/java/org/apache/sedona/core/joinJudgement/LeftIndexLookupJudgement.java
@@ -1,26 +1,28 @@
/*
- * FILE: LeftIndexLookupJudgement
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.joinJudgement;
+package org.apache.sedona.core.joinJudgement;
-import org.locationtech.jts.geom.Geometry;
-import org.locationtech.jts.index.SpatialIndex;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.spark.api.java.function.FlatMapFunction2;
+import org.locationtech.jts.geom.Geometry;
+import org.locationtech.jts.index.SpatialIndex;
import javax.annotation.Nullable;
diff --git a/core/src/main/java/org/datasyslab/geospark/joinJudgement/NestedLoopJudgement.java b/core/src/main/java/org/apache/sedona/core/joinJudgement/NestedLoopJudgement.java
similarity index 67%
rename from core/src/main/java/org/datasyslab/geospark/joinJudgement/NestedLoopJudgement.java
rename to core/src/main/java/org/apache/sedona/core/joinJudgement/NestedLoopJudgement.java
index dc4e9cb..fead29e 100644
--- a/core/src/main/java/org/datasyslab/geospark/joinJudgement/NestedLoopJudgement.java
+++ b/core/src/main/java/org/apache/sedona/core/joinJudgement/NestedLoopJudgement.java
@@ -1,26 +1,29 @@
/*
- * FILE: NestedLoopJudgement
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.joinJudgement;
-import org.locationtech.jts.geom.Geometry;
+package org.apache.sedona.core.joinJudgement;
+
import org.apache.commons.lang3.tuple.Pair;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.apache.spark.api.java.function.FlatMapFunction2;
+import org.locationtech.jts.geom.Geometry;
import javax.annotation.Nullable;
diff --git a/core/src/main/java/org/datasyslab/geospark/joinJudgement/RightIndexLookupJudgement.java b/core/src/main/java/org/apache/sedona/core/joinJudgement/RightIndexLookupJudgement.java
similarity index 67%
rename from core/src/main/java/org/datasyslab/geospark/joinJudgement/RightIndexLookupJudgement.java
rename to core/src/main/java/org/apache/sedona/core/joinJudgement/RightIndexLookupJudgement.java
index ca2df3a..be9c63d 100644
--- a/core/src/main/java/org/datasyslab/geospark/joinJudgement/RightIndexLookupJudgement.java
+++ b/core/src/main/java/org/apache/sedona/core/joinJudgement/RightIndexLookupJudgement.java
@@ -1,26 +1,28 @@
/*
- * FILE: RightIndexLookupJudgement
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.joinJudgement;
+package org.apache.sedona.core.joinJudgement;
-import org.locationtech.jts.geom.Geometry;
-import org.locationtech.jts.index.SpatialIndex;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.spark.api.java.function.FlatMapFunction2;
+import org.locationtech.jts.geom.Geometry;
+import org.locationtech.jts.index.SpatialIndex;
import javax.annotation.Nullable;
diff --git a/core/src/main/java/org/datasyslab/geospark/knnJudgement/GeometryDistanceComparator.java b/core/src/main/java/org/apache/sedona/core/knnJudgement/GeometryDistanceComparator.java
similarity index 63%
rename from core/src/main/java/org/datasyslab/geospark/knnJudgement/GeometryDistanceComparator.java
rename to core/src/main/java/org/apache/sedona/core/knnJudgement/GeometryDistanceComparator.java
index 4f1504a..86dcf3c 100644
--- a/core/src/main/java/org/datasyslab/geospark/knnJudgement/GeometryDistanceComparator.java
+++ b/core/src/main/java/org/apache/sedona/core/knnJudgement/GeometryDistanceComparator.java
@@ -1,20 +1,23 @@
/*
- * FILE: GeometryDistanceComparator
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.knnJudgement;
+
+package org.apache.sedona.core.knnJudgement;
import org.locationtech.jts.geom.Geometry;
diff --git a/core/src/main/java/org/datasyslab/geospark/knnJudgement/KnnJudgement.java b/core/src/main/java/org/apache/sedona/core/knnJudgement/KnnJudgement.java
similarity index 64%
rename from core/src/main/java/org/datasyslab/geospark/knnJudgement/KnnJudgement.java
rename to core/src/main/java/org/apache/sedona/core/knnJudgement/KnnJudgement.java
index a841bdc..df2d006 100644
--- a/core/src/main/java/org/datasyslab/geospark/knnJudgement/KnnJudgement.java
+++ b/core/src/main/java/org/apache/sedona/core/knnJudgement/KnnJudgement.java
@@ -1,23 +1,26 @@
/*
- * FILE: KnnJudgement
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.knnJudgement;
-import org.locationtech.jts.geom.Geometry;
+package org.apache.sedona.core.knnJudgement;
+
import org.apache.spark.api.java.function.FlatMapFunction;
+import org.locationtech.jts.geom.Geometry;
import java.io.Serializable;
import java.util.ArrayList;
@@ -70,7 +73,7 @@ public class KnnJudgement<U extends Geometry, T extends Geometry>
else {
T curpoint = input.next();
double distance = curpoint.distance(queryCenter);
- double largestDistanceInPriQueue = ((Geometry) pq.peek()).distance(queryCenter);
+ double largestDistanceInPriQueue = pq.peek().distance(queryCenter);
if (largestDistanceInPriQueue > distance) {
pq.poll();
pq.offer(curpoint);
diff --git a/core/src/main/java/org/datasyslab/geospark/knnJudgement/KnnJudgementUsingIndex.java b/core/src/main/java/org/apache/sedona/core/knnJudgement/KnnJudgementUsingIndex.java
similarity index 68%
rename from core/src/main/java/org/datasyslab/geospark/knnJudgement/KnnJudgementUsingIndex.java
rename to core/src/main/java/org/apache/sedona/core/knnJudgement/KnnJudgementUsingIndex.java
index f4ce367..f7a2b10 100644
--- a/core/src/main/java/org/datasyslab/geospark/knnJudgement/KnnJudgementUsingIndex.java
+++ b/core/src/main/java/org/apache/sedona/core/knnJudgement/KnnJudgementUsingIndex.java
@@ -1,26 +1,29 @@
/*
- * FILE: KnnJudgementUsingIndex
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.knnJudgement;
+package org.apache.sedona.core.knnJudgement;
+
+import org.apache.spark.api.java.function.FlatMapFunction;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.index.SpatialIndex;
import org.locationtech.jts.index.strtree.GeometryItemDistance;
import org.locationtech.jts.index.strtree.STRtree;
-import org.apache.spark.api.java.function.FlatMapFunction;
import java.io.Serializable;
import java.util.ArrayList;
diff --git a/core/src/main/java/org/datasyslab/geospark/rangeJudgement/JudgementBase.java b/core/src/main/java/org/apache/sedona/core/rangeJudgement/JudgementBase.java
similarity index 50%
rename from core/src/main/java/org/datasyslab/geospark/rangeJudgement/JudgementBase.java
rename to core/src/main/java/org/apache/sedona/core/rangeJudgement/JudgementBase.java
index 17332e4..f76d535 100644
--- a/core/src/main/java/org/datasyslab/geospark/rangeJudgement/JudgementBase.java
+++ b/core/src/main/java/org/apache/sedona/core/rangeJudgement/JudgementBase.java
@@ -1,25 +1,27 @@
/*
- * FILE: JudgementBase
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.rangeJudgement;
+package org.apache.sedona.core.rangeJudgement;
-import org.locationtech.jts.geom.Geometry;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
+import org.locationtech.jts.geom.Geometry;
import java.io.Serializable;
@@ -28,9 +30,9 @@ public class JudgementBase<U extends Geometry>
{
private static final Logger log = LogManager.getLogger(JudgementBase.class);
- private boolean considerBoundaryIntersection;
- U queryGeometry;
+ private final boolean considerBoundaryIntersection;
protected boolean leftCoveredByRight = true;
+ U queryGeometry;
/**
* Instantiates a new range filter using index.
@@ -48,11 +50,10 @@ public class JudgementBase<U extends Geometry>
public boolean match(Geometry spatialObject, Geometry queryWindow)
{
if (considerBoundaryIntersection) {
- if (queryWindow.intersects(spatialObject)) { return true; }
+ return queryWindow.intersects(spatialObject);
}
else {
- if (queryWindow.covers(spatialObject)) { return true; }
+ return queryWindow.covers(spatialObject);
}
- return false;
}
}
diff --git a/core/src/main/java/org/apache/sedona/core/rangeJudgement/RangeFilter.java b/core/src/main/java/org/apache/sedona/core/rangeJudgement/RangeFilter.java
new file mode 100644
index 0000000..54aea09
--- /dev/null
+++ b/core/src/main/java/org/apache/sedona/core/rangeJudgement/RangeFilter.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.rangeJudgement;
+
+import org.apache.spark.api.java.function.Function;
+import org.locationtech.jts.geom.Geometry;
+
+// TODO: Auto-generated Javadoc
+
+public class RangeFilter<U extends Geometry, T extends Geometry>
+ extends JudgementBase
+ implements Function<T, Boolean>
+{
+
+ public RangeFilter(U queryWindow, boolean considerBoundaryIntersection, boolean leftCoveredByRight)
+ {
+ super(queryWindow, considerBoundaryIntersection, leftCoveredByRight);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.spark.api.java.function.Function#call(java.lang.Object)
+ */
+ public Boolean call(T geometry)
+ throws Exception
+ {
+ if (leftCoveredByRight) {
+ return match(geometry, queryGeometry);
+ }
+ else {
+ return match(queryGeometry, queryGeometry);
+ }
+ }
+}
diff --git a/core/src/main/java/org/datasyslab/geospark/rangeJudgement/RangeFilterUsingIndex.java b/core/src/main/java/org/apache/sedona/core/rangeJudgement/RangeFilterUsingIndex.java
similarity index 66%
rename from core/src/main/java/org/datasyslab/geospark/rangeJudgement/RangeFilterUsingIndex.java
rename to core/src/main/java/org/apache/sedona/core/rangeJudgement/RangeFilterUsingIndex.java
index bd07e15..9c32204 100644
--- a/core/src/main/java/org/datasyslab/geospark/rangeJudgement/RangeFilterUsingIndex.java
+++ b/core/src/main/java/org/apache/sedona/core/rangeJudgement/RangeFilterUsingIndex.java
@@ -1,24 +1,27 @@
/*
- * FILE: RangeFilterUsingIndex
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.rangeJudgement;
+package org.apache.sedona.core.rangeJudgement;
+
+import org.apache.spark.api.java.function.FlatMapFunction;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.index.SpatialIndex;
-import org.apache.spark.api.java.function.FlatMapFunction;
import java.util.ArrayList;
import java.util.Iterator;
diff --git a/core/src/main/java/org/datasyslab/geospark/serde/GeoSparkKryoRegistrator.java b/core/src/main/java/org/apache/sedona/core/serde/SedonaKryoRegistrator.java
similarity index 58%
rename from core/src/main/java/org/datasyslab/geospark/serde/GeoSparkKryoRegistrator.java
rename to core/src/main/java/org/apache/sedona/core/serde/SedonaKryoRegistrator.java
index bff5687..57894ea 100644
--- a/core/src/main/java/org/datasyslab/geospark/serde/GeoSparkKryoRegistrator.java
+++ b/core/src/main/java/org/apache/sedona/core/serde/SedonaKryoRegistrator.java
@@ -1,23 +1,30 @@
/*
- * FILE: GeoSparkKryoRegistrator
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.serde;
+package org.apache.sedona.core.serde;
import com.esotericsoftware.kryo.Kryo;
+import org.apache.log4j.Logger;
+import org.apache.sedona.core.geometryObjects.Circle;
+import org.apache.sedona.core.geometryObjects.GeometrySerde;
+import org.apache.sedona.core.geometryObjects.SpatialIndexSerde;
+import org.apache.spark.serializer.KryoRegistrator;
import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.GeometryCollection;
import org.locationtech.jts.geom.LineString;
@@ -28,17 +35,12 @@ import org.locationtech.jts.geom.Point;
import org.locationtech.jts.geom.Polygon;
import org.locationtech.jts.index.quadtree.Quadtree;
import org.locationtech.jts.index.strtree.STRtree;
-import org.apache.log4j.Logger;
-import org.apache.spark.serializer.KryoRegistrator;
-import org.datasyslab.geospark.geometryObjects.Circle;
-import org.datasyslab.geospark.geometryObjects.GeometrySerde;
-import org.datasyslab.geospark.geometryObjects.SpatialIndexSerde;
-public class GeoSparkKryoRegistrator
+public class SedonaKryoRegistrator
implements KryoRegistrator
{
- final static Logger log = Logger.getLogger(GeoSparkKryoRegistrator.class);
+ final static Logger log = Logger.getLogger(SedonaKryoRegistrator.class);
@Override
public void registerClasses(Kryo kryo)
diff --git a/core/src/main/java/org/datasyslab/geospark/showcase/EarthdataMapperRunnableExample.java b/core/src/main/java/org/apache/sedona/core/showcase/EarthdataMapperRunnableExample.java
similarity index 77%
rename from core/src/main/java/org/datasyslab/geospark/showcase/EarthdataMapperRunnableExample.java
rename to core/src/main/java/org/apache/sedona/core/showcase/EarthdataMapperRunnableExample.java
index c177c76..ed86b1f 100644
--- a/core/src/main/java/org/datasyslab/geospark/showcase/EarthdataMapperRunnableExample.java
+++ b/core/src/main/java/org/apache/sedona/core/showcase/EarthdataMapperRunnableExample.java
@@ -1,34 +1,37 @@
/*
- * FILE: EarthdataMapperRunnableExample
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.showcase;
-import org.locationtech.jts.geom.Envelope;
+package org.apache.sedona.core.showcase;
+
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
+import org.apache.sedona.core.enums.FileDataSplitter;
+import org.apache.sedona.core.enums.IndexType;
+import org.apache.sedona.core.formatMapper.EarthdataHDFPointMapper;
+import org.apache.sedona.core.serde.SedonaKryoRegistrator;
+import org.apache.sedona.core.spatialOperator.RangeQuery;
+import org.apache.sedona.core.spatialRDD.PointRDD;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.serializer.KryoSerializer;
import org.apache.spark.storage.StorageLevel;
-import org.datasyslab.geospark.enums.FileDataSplitter;
-import org.datasyslab.geospark.enums.IndexType;
-import org.datasyslab.geospark.formatMapper.EarthdataHDFPointMapper;
-import org.datasyslab.geospark.serde.GeoSparkKryoRegistrator;
-import org.datasyslab.geospark.spatialOperator.RangeQuery;
-import org.datasyslab.geospark.spatialRDD.PointRDD;
+import org.locationtech.jts.geom.Envelope;
// TODO: Auto-generated Javadoc
@@ -112,7 +115,7 @@ public class EarthdataMapperRunnableExample
{
SparkConf conf = new SparkConf().setAppName("EarthdataMapperRunnableExample").setMaster("local[2]");
conf.set("spark.serializer", KryoSerializer.class.getName());
- conf.set("spark.kryo.registrator", GeoSparkKryoRegistrator.class.getName());
+ conf.set("spark.kryo.registrator", SedonaKryoRegistrator.class.getName());
sc = new JavaSparkContext(conf);
Logger.getLogger("org").setLevel(Level.WARN);
Logger.getLogger("akka").setLevel(Level.WARN);
@@ -130,7 +133,7 @@ public class EarthdataMapperRunnableExample
testSpatialRangeQuery();
testSpatialRangeQueryUsingIndex();
sc.stop();
- System.out.println("All GeoSpark Earthdata DEMOs passed!");
+ System.out.println("All Earthdata DEMOs passed!");
}
/**
diff --git a/core/src/main/java/org/datasyslab/geospark/showcase/Example.java b/core/src/main/java/org/apache/sedona/core/showcase/Example.java
similarity index 87%
rename from core/src/main/java/org/datasyslab/geospark/showcase/Example.java
rename to core/src/main/java/org/apache/sedona/core/showcase/Example.java
index 9ec067e..358fe74 100644
--- a/core/src/main/java/org/datasyslab/geospark/showcase/Example.java
+++ b/core/src/main/java/org/apache/sedona/core/showcase/Example.java
@@ -1,42 +1,45 @@
/*
- * FILE: Example
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.showcase;
-import org.locationtech.jts.geom.Coordinate;
-import org.locationtech.jts.geom.Envelope;
-import org.locationtech.jts.geom.GeometryFactory;
-import org.locationtech.jts.geom.Point;
+package org.apache.sedona.core.showcase;
+
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
+import org.apache.sedona.core.enums.FileDataSplitter;
+import org.apache.sedona.core.enums.GridType;
+import org.apache.sedona.core.enums.IndexType;
+import org.apache.sedona.core.formatMapper.shapefileParser.ShapefileRDD;
+import org.apache.sedona.core.serde.SedonaKryoRegistrator;
+import org.apache.sedona.core.spatialOperator.JoinQuery;
+import org.apache.sedona.core.spatialOperator.KNNQuery;
+import org.apache.sedona.core.spatialOperator.RangeQuery;
+import org.apache.sedona.core.spatialRDD.CircleRDD;
+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.apache.spark.serializer.KryoSerializer;
import org.apache.spark.storage.StorageLevel;
-import org.datasyslab.geospark.enums.FileDataSplitter;
-import org.datasyslab.geospark.enums.GridType;
-import org.datasyslab.geospark.enums.IndexType;
-import org.datasyslab.geospark.formatMapper.shapefileParser.ShapefileRDD;
-import org.datasyslab.geospark.serde.GeoSparkKryoRegistrator;
-import org.datasyslab.geospark.spatialOperator.JoinQuery;
-import org.datasyslab.geospark.spatialOperator.KNNQuery;
-import org.datasyslab.geospark.spatialOperator.RangeQuery;
-import org.datasyslab.geospark.spatialRDD.CircleRDD;
-import org.datasyslab.geospark.spatialRDD.PointRDD;
-import org.datasyslab.geospark.spatialRDD.PolygonRDD;
+import org.locationtech.jts.geom.Coordinate;
+import org.locationtech.jts.geom.Envelope;
+import org.locationtech.jts.geom.GeometryFactory;
+import org.locationtech.jts.geom.Point;
import java.io.Serializable;
import java.util.List;
@@ -149,9 +152,9 @@ public class Example
*/
public static void main(String[] args)
{
- SparkConf conf = new SparkConf().setAppName("GeoSparkRunnableExample").setMaster("local[2]");
+ SparkConf conf = new SparkConf().setAppName("SedonaRunnableExample").setMaster("local[2]");
conf.set("spark.serializer", KryoSerializer.class.getName());
- conf.set("spark.kryo.registrator", GeoSparkKryoRegistrator.class.getName());
+ conf.set("spark.kryo.registrator", SedonaKryoRegistrator.class.getName());
sc = new JavaSparkContext(conf);
Logger.getLogger("org").setLevel(Level.WARN);
@@ -194,11 +197,11 @@ public class Example
}
catch (Exception e) {
e.printStackTrace();
- System.out.println("GeoSpark DEMOs failed!");
+ System.out.println("DEMOs failed!");
return;
}
sc.stop();
- System.out.println("All GeoSpark DEMOs passed!");
+ System.out.println("All DEMOs passed!");
}
/**
diff --git a/core/src/main/java/org/datasyslab/geospark/showcase/UserSuppliedLineStringMapper.java b/core/src/main/java/org/apache/sedona/core/showcase/UserSuppliedLineStringMapper.java
similarity index 72%
rename from core/src/main/java/org/datasyslab/geospark/showcase/UserSuppliedLineStringMapper.java
rename to core/src/main/java/org/apache/sedona/core/showcase/UserSuppliedLineStringMapper.java
index fbc4045..9d5cc79 100644
--- a/core/src/main/java/org/datasyslab/geospark/showcase/UserSuppliedLineStringMapper.java
+++ b/core/src/main/java/org/apache/sedona/core/showcase/UserSuppliedLineStringMapper.java
@@ -1,21 +1,25 @@
/*
- * FILE: UserSuppliedLineStringMapper
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.showcase;
+package org.apache.sedona.core.showcase;
+
+import org.apache.spark.api.java.function.FlatMapFunction;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.GeometryFactory;
@@ -24,7 +28,6 @@ import org.locationtech.jts.geom.LinearRing;
import org.locationtech.jts.geom.MultiLineString;
import org.locationtech.jts.geom.MultiPolygon;
import org.locationtech.jts.io.WKTReader;
-import org.apache.spark.api.java.function.FlatMapFunction;
import java.util.ArrayList;
import java.util.Arrays;
@@ -98,11 +101,11 @@ public class UserSuppliedLineStringMapper
multiSpatialObjects = (MultiLineString) spatialObject;
for (int i = 0; i < multiSpatialObjects.getNumGeometries(); i++) {
spatialObject = multiSpatialObjects.getGeometryN(i);
- result.add((LineString) spatialObject);
+ result.add(spatialObject);
}
}
else {
- result.add((LineString) spatialObject);
+ result.add(spatialObject);
}
}
return result.iterator();
diff --git a/core/src/main/java/org/datasyslab/geospark/showcase/UserSuppliedPointMapper.java b/core/src/main/java/org/apache/sedona/core/showcase/UserSuppliedPointMapper.java
similarity index 64%
rename from core/src/main/java/org/datasyslab/geospark/showcase/UserSuppliedPointMapper.java
rename to core/src/main/java/org/apache/sedona/core/showcase/UserSuppliedPointMapper.java
index b3a785b..603c626 100644
--- a/core/src/main/java/org/datasyslab/geospark/showcase/UserSuppliedPointMapper.java
+++ b/core/src/main/java/org/apache/sedona/core/showcase/UserSuppliedPointMapper.java
@@ -1,25 +1,28 @@
/*
- * FILE: UserSuppliedPointMapper
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.showcase;
+package org.apache.sedona.core.showcase;
+
+import org.apache.spark.api.java.function.FlatMapFunction;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.Point;
-import org.apache.spark.api.java.function.FlatMapFunction;
import java.util.ArrayList;
import java.util.Iterator;
diff --git a/core/src/main/java/org/datasyslab/geospark/showcase/UserSuppliedPolygonMapper.java b/core/src/main/java/org/apache/sedona/core/showcase/UserSuppliedPolygonMapper.java
similarity index 72%
rename from core/src/main/java/org/datasyslab/geospark/showcase/UserSuppliedPolygonMapper.java
rename to core/src/main/java/org/apache/sedona/core/showcase/UserSuppliedPolygonMapper.java
index 548e9c7..e52f0e8 100644
--- a/core/src/main/java/org/datasyslab/geospark/showcase/UserSuppliedPolygonMapper.java
+++ b/core/src/main/java/org/apache/sedona/core/showcase/UserSuppliedPolygonMapper.java
@@ -1,21 +1,25 @@
/*
- * FILE: UserSuppliedPolygonMapper
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.showcase;
+package org.apache.sedona.core.showcase;
+
+import org.apache.spark.api.java.function.FlatMapFunction;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.GeometryFactory;
@@ -23,7 +27,6 @@ import org.locationtech.jts.geom.LinearRing;
import org.locationtech.jts.geom.MultiPolygon;
import org.locationtech.jts.geom.Polygon;
import org.locationtech.jts.io.WKTReader;
-import org.apache.spark.api.java.function.FlatMapFunction;
import java.util.ArrayList;
import java.util.Arrays;
@@ -102,11 +105,11 @@ public class UserSuppliedPolygonMapper
multiSpatialObjects = (MultiPolygon) spatialObject;
for (int i = 0; i < multiSpatialObjects.getNumGeometries(); i++) {
spatialObject = multiSpatialObjects.getGeometryN(i);
- result.add((Polygon) spatialObject);
+ result.add(spatialObject);
}
}
else {
- result.add((Polygon) spatialObject);
+ result.add(spatialObject);
}
}
return result.iterator();
diff --git a/core/src/main/java/org/datasyslab/geospark/showcase/UserSuppliedRectangleMapper.java b/core/src/main/java/org/apache/sedona/core/showcase/UserSuppliedRectangleMapper.java
similarity index 70%
rename from core/src/main/java/org/datasyslab/geospark/showcase/UserSuppliedRectangleMapper.java
rename to core/src/main/java/org/apache/sedona/core/showcase/UserSuppliedRectangleMapper.java
index 6625546..8b98542 100644
--- a/core/src/main/java/org/datasyslab/geospark/showcase/UserSuppliedRectangleMapper.java
+++ b/core/src/main/java/org/apache/sedona/core/showcase/UserSuppliedRectangleMapper.java
@@ -1,30 +1,32 @@
/*
- * FILE: UserSuppliedRectangleMapper
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.showcase;
+package org.apache.sedona.core.showcase;
+
+import org.apache.spark.api.java.function.FlatMapFunction;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.LinearRing;
import org.locationtech.jts.geom.MultiPolygon;
-import org.locationtech.jts.geom.Polygon;
import org.locationtech.jts.io.WKTReader;
-import org.apache.spark.api.java.function.FlatMapFunction;
import java.util.ArrayList;
import java.util.Arrays;
@@ -98,11 +100,11 @@ public class UserSuppliedRectangleMapper
multiSpatialObjects = (MultiPolygon) spatialObject;
for (int i = 0; i < multiSpatialObjects.getNumGeometries(); i++) {
spatialObject = multiSpatialObjects.getGeometryN(i);
- result.add(((Polygon) spatialObject).getEnvelopeInternal());
+ result.add(spatialObject.getEnvelopeInternal());
}
}
else {
- result.add(((Polygon) spatialObject).getEnvelopeInternal());
+ result.add(spatialObject.getEnvelopeInternal());
}
}
return result.iterator();
diff --git a/core/src/main/java/org/datasyslab/geospark/spatialOperator/JoinQuery.java b/core/src/main/java/org/apache/sedona/core/spatialOperator/JoinQuery.java
similarity index 92%
rename from core/src/main/java/org/datasyslab/geospark/spatialOperator/JoinQuery.java
rename to core/src/main/java/org/apache/sedona/core/spatialOperator/JoinQuery.java
index 9ca0fb5..82fec48 100644
--- a/core/src/main/java/org/datasyslab/geospark/spatialOperator/JoinQuery.java
+++ b/core/src/main/java/org/apache/sedona/core/spatialOperator/JoinQuery.java
@@ -1,43 +1,46 @@
/*
- * FILE: JoinQuery
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.spatialOperator;
-import org.locationtech.jts.geom.Geometry;
+package org.apache.sedona.core.spatialOperator;
+
import org.apache.commons.lang3.tuple.Pair;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
+import org.apache.sedona.core.enums.IndexType;
+import org.apache.sedona.core.enums.JoinBuildSide;
+import org.apache.sedona.core.geometryObjects.Circle;
+import org.apache.sedona.core.joinJudgement.DedupParams;
+import org.apache.sedona.core.joinJudgement.DynamicIndexLookupJudgement;
+import org.apache.sedona.core.joinJudgement.LeftIndexLookupJudgement;
+import org.apache.sedona.core.joinJudgement.NestedLoopJudgement;
+import org.apache.sedona.core.joinJudgement.RightIndexLookupJudgement;
+import org.apache.sedona.core.monitoring.Metric;
+import org.apache.sedona.core.spatialPartitioning.SpatialPartitioner;
+import org.apache.sedona.core.spatialRDD.CircleRDD;
+import org.apache.sedona.core.spatialRDD.SpatialRDD;
import org.apache.spark.SparkContext;
import org.apache.spark.api.java.JavaPairRDD;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.function.Function2;
import org.apache.spark.api.java.function.PairFunction;
-import org.datasyslab.geospark.enums.IndexType;
-import org.datasyslab.geospark.enums.JoinBuildSide;
-import org.datasyslab.geospark.geometryObjects.Circle;
-import org.datasyslab.geospark.joinJudgement.DedupParams;
-import org.datasyslab.geospark.joinJudgement.DynamicIndexLookupJudgement;
-import org.datasyslab.geospark.joinJudgement.LeftIndexLookupJudgement;
-import org.datasyslab.geospark.joinJudgement.NestedLoopJudgement;
-import org.datasyslab.geospark.joinJudgement.RightIndexLookupJudgement;
-import org.datasyslab.geospark.monitoring.GeoSparkMetric;
-import org.datasyslab.geospark.monitoring.GeoSparkMetrics;
-import org.datasyslab.geospark.spatialPartitioning.SpatialPartitioner;
-import org.datasyslab.geospark.spatialRDD.CircleRDD;
-import org.datasyslab.geospark.spatialRDD.SpatialRDD;
+import org.apache.sedona.core.monitoring.Metrics;
+import org.locationtech.jts.geom.Geometry;
import scala.Tuple2;
import java.util.HashSet;
@@ -134,33 +137,6 @@ public class JoinQuery
});
}
- public static final class JoinParams
- {
- public final boolean useIndex;
- public final boolean considerBoundaryIntersection;
- public final boolean allowDuplicates;
- public final IndexType indexType;
- public final JoinBuildSide joinBuildSide;
-
- public JoinParams(boolean useIndex, boolean considerBoundaryIntersection, boolean allowDuplicates)
- {
- this.useIndex = useIndex;
- this.considerBoundaryIntersection = considerBoundaryIntersection;
- this.allowDuplicates = allowDuplicates;
- this.indexType = IndexType.RTREE;
- this.joinBuildSide = JoinBuildSide.RIGHT;
- }
-
- public JoinParams(boolean considerBoundaryIntersection, IndexType polygonIndexType, JoinBuildSide joinBuildSide)
- {
- this.useIndex = false;
- this.considerBoundaryIntersection = considerBoundaryIntersection;
- this.allowDuplicates = false;
- this.indexType = polygonIndexType;
- this.joinBuildSide = joinBuildSide;
- }
- }
-
/**
* Inner joins two sets of geometries on 'contains' or 'intersects' relationship.
* <p>
@@ -432,7 +408,7 @@ public class JoinQuery
public Tuple2<Geometry, T> call(Tuple2<Circle, T> circleTTuple2)
throws Exception
{
- return new Tuple2<Geometry, T>((Geometry) circleTTuple2._1().getCenterGeometry(), circleTTuple2._2());
+ return new Tuple2<Geometry, T>(circleTTuple2._1().getCenterGeometry(), circleTTuple2._2());
}
});
}
@@ -453,10 +429,10 @@ public class JoinQuery
verifyPartitioningMatch(leftRDD, rightRDD);
SparkContext sparkContext = leftRDD.spatialPartitionedRDD.context();
- GeoSparkMetric buildCount = GeoSparkMetrics.createMetric(sparkContext, "buildCount");
- GeoSparkMetric streamCount = GeoSparkMetrics.createMetric(sparkContext, "streamCount");
- GeoSparkMetric resultCount = GeoSparkMetrics.createMetric(sparkContext, "resultCount");
- GeoSparkMetric candidateCount = GeoSparkMetrics.createMetric(sparkContext, "candidateCount");
+ Metric buildCount = Metrics.createMetric(sparkContext, "buildCount");
+ Metric streamCount = Metrics.createMetric(sparkContext, "streamCount");
+ Metric resultCount = Metrics.createMetric(sparkContext, "resultCount");
+ Metric candidateCount = Metrics.createMetric(sparkContext, "candidateCount");
final SpatialPartitioner partitioner =
(SpatialPartitioner) rightRDD.spatialPartitionedRDD.partitioner().get();
@@ -517,5 +493,32 @@ public class JoinQuery
}
});
}
+
+ public static final class JoinParams
+ {
+ public final boolean useIndex;
+ public final boolean considerBoundaryIntersection;
+ public final boolean allowDuplicates;
+ public final IndexType indexType;
+ public final JoinBuildSide joinBuildSide;
+
+ public JoinParams(boolean useIndex, boolean considerBoundaryIntersection, boolean allowDuplicates)
+ {
+ this.useIndex = useIndex;
+ this.considerBoundaryIntersection = considerBoundaryIntersection;
+ this.allowDuplicates = allowDuplicates;
+ this.indexType = IndexType.RTREE;
+ this.joinBuildSide = JoinBuildSide.RIGHT;
+ }
+
+ public JoinParams(boolean considerBoundaryIntersection, IndexType polygonIndexType, JoinBuildSide joinBuildSide)
+ {
+ this.useIndex = false;
+ this.considerBoundaryIntersection = considerBoundaryIntersection;
+ this.allowDuplicates = false;
+ this.indexType = polygonIndexType;
+ this.joinBuildSide = joinBuildSide;
+ }
+ }
}
diff --git a/core/src/main/java/org/datasyslab/geospark/spatialOperator/KNNQuery.java b/core/src/main/java/org/apache/sedona/core/spatialOperator/KNNQuery.java
similarity index 59%
rename from core/src/main/java/org/datasyslab/geospark/spatialOperator/KNNQuery.java
rename to core/src/main/java/org/apache/sedona/core/spatialOperator/KNNQuery.java
index 1ea5730..68948ab 100644
--- a/core/src/main/java/org/datasyslab/geospark/spatialOperator/KNNQuery.java
+++ b/core/src/main/java/org/apache/sedona/core/spatialOperator/KNNQuery.java
@@ -1,28 +1,31 @@
/*
- * FILE: KNNQuery
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.spatialOperator;
-import org.locationtech.jts.geom.Geometry;
+package org.apache.sedona.core.spatialOperator;
+
+import org.apache.sedona.core.knnJudgement.GeometryDistanceComparator;
+import org.apache.sedona.core.knnJudgement.KnnJudgement;
+import org.apache.sedona.core.knnJudgement.KnnJudgementUsingIndex;
+import org.apache.sedona.core.spatialRDD.SpatialRDD;
+import org.apache.sedona.core.utils.CRSTransformation;
import org.apache.spark.api.java.JavaRDD;
-import org.datasyslab.geospark.knnJudgement.GeometryDistanceComparator;
-import org.datasyslab.geospark.knnJudgement.KnnJudgement;
-import org.datasyslab.geospark.knnJudgement.KnnJudgementUsingIndex;
-import org.datasyslab.geospark.spatialRDD.SpatialRDD;
-import org.datasyslab.geospark.utils.CRSTransformation;
+import org.locationtech.jts.geom.Geometry;
import java.io.Serializable;
import java.util.List;
diff --git a/core/src/main/java/org/datasyslab/geospark/spatialOperator/RangeQuery.java b/core/src/main/java/org/apache/sedona/core/spatialOperator/RangeQuery.java
similarity index 84%
rename from core/src/main/java/org/datasyslab/geospark/spatialOperator/RangeQuery.java
rename to core/src/main/java/org/apache/sedona/core/spatialOperator/RangeQuery.java
index b37e7ff..c502c18 100644
--- a/core/src/main/java/org/datasyslab/geospark/spatialOperator/RangeQuery.java
+++ b/core/src/main/java/org/apache/sedona/core/spatialOperator/RangeQuery.java
@@ -1,30 +1,33 @@
/*
- * FILE: RangeQuery
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.spatialOperator;
+package org.apache.sedona.core.spatialOperator;
+
+import org.apache.sedona.core.rangeJudgement.RangeFilter;
+import org.apache.sedona.core.rangeJudgement.RangeFilterUsingIndex;
+import org.apache.sedona.core.spatialRDD.SpatialRDD;
+import org.apache.sedona.core.utils.CRSTransformation;
+import org.apache.spark.api.java.JavaRDD;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.GeometryFactory;
-import org.apache.spark.api.java.JavaRDD;
-import org.datasyslab.geospark.rangeJudgement.RangeFilter;
-import org.datasyslab.geospark.rangeJudgement.RangeFilterUsingIndex;
-import org.datasyslab.geospark.spatialRDD.SpatialRDD;
-import org.datasyslab.geospark.utils.CRSTransformation;
import java.io.Serializable;
diff --git a/core/src/main/java/org/datasyslab/geospark/spatialPartitioning/EqualPartitioning.java b/core/src/main/java/org/apache/sedona/core/spatialPartitioning/EqualPartitioning.java
similarity index 67%
rename from core/src/main/java/org/datasyslab/geospark/spatialPartitioning/EqualPartitioning.java
rename to core/src/main/java/org/apache/sedona/core/spatialPartitioning/EqualPartitioning.java
index ae79175..02759b8 100644
--- a/core/src/main/java/org/datasyslab/geospark/spatialPartitioning/EqualPartitioning.java
+++ b/core/src/main/java/org/apache/sedona/core/spatialPartitioning/EqualPartitioning.java
@@ -1,20 +1,23 @@
/*
- * FILE: EqualPartitioning
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.spatialPartitioning;
+
+package org.apache.sedona.core.spatialPartitioning;
import org.locationtech.jts.geom.Envelope;
diff --git a/core/src/main/java/org/datasyslab/geospark/spatialPartitioning/FlatGridPartitioner.java b/core/src/main/java/org/apache/sedona/core/spatialPartitioning/FlatGridPartitioner.java
similarity index 77%
rename from core/src/main/java/org/datasyslab/geospark/spatialPartitioning/FlatGridPartitioner.java
rename to core/src/main/java/org/apache/sedona/core/spatialPartitioning/FlatGridPartitioner.java
index cf77f15..040362f 100644
--- a/core/src/main/java/org/datasyslab/geospark/spatialPartitioning/FlatGridPartitioner.java
+++ b/core/src/main/java/org/apache/sedona/core/spatialPartitioning/FlatGridPartitioner.java
@@ -1,25 +1,28 @@
/*
- * FILE: FlatGridPartitioner
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.spatialPartitioning;
+package org.apache.sedona.core.spatialPartitioning;
+
+import org.apache.sedona.core.enums.GridType;
+import org.apache.sedona.core.joinJudgement.DedupParams;
import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.Geometry;
-import org.datasyslab.geospark.enums.GridType;
-import org.datasyslab.geospark.joinJudgement.DedupParams;
import scala.Tuple2;
import javax.annotation.Nullable;
diff --git a/core/src/main/java/org/datasyslab/geospark/spatialPartitioning/HilbertPartitioning.java b/core/src/main/java/org/apache/sedona/core/spatialPartitioning/HilbertPartitioning.java
similarity index 86%
rename from core/src/main/java/org/datasyslab/geospark/spatialPartitioning/HilbertPartitioning.java
rename to core/src/main/java/org/apache/sedona/core/spatialPartitioning/HilbertPartitioning.java
index 66aa2e3..e8e6e98 100644
--- a/core/src/main/java/org/datasyslab/geospark/spatialPartitioning/HilbertPartitioning.java
+++ b/core/src/main/java/org/apache/sedona/core/spatialPartitioning/HilbertPartitioning.java
@@ -1,20 +1,23 @@
/*
- * FILE: HilbertPartitioning
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.spatialPartitioning;
+
+package org.apache.sedona.core.spatialPartitioning;
import org.locationtech.jts.geom.Envelope;
@@ -78,24 +81,6 @@ public class HilbertPartitioning
}
/**
- * Creates the from H values.
- *
- * @param hValues the h values
- * @param partitions the partitions
- */
- protected void createFromHValues(int[] hValues, int partitions)
- {
- Arrays.sort(hValues);
-
- this.splits = new int[partitions];
- int maxH = 0x7fffffff;
- for (int i = 0; i < splits.length; i++) {
- int quantile = (int) ((long) (i + 1) * hValues.length / partitions);
- this.splits[i] = quantile == hValues.length ? maxH : hValues[quantile];
- }
- }
-
- /**
* Compute H value.
*
* @param n the n
@@ -128,16 +113,6 @@ public class HilbertPartitioning
}
/**
- * Gets the partition bounds.
- *
- * @return the partition bounds
- */
- public int[] getPartitionBounds()
- {
- return splits;
- }
-
- /**
* Location mapping.
*
* @param axisMin the axis min
@@ -198,6 +173,34 @@ public class HilbertPartitioning
}
/**
+ * Creates the from H values.
+ *
+ * @param hValues the h values
+ * @param partitions the partitions
+ */
+ protected void createFromHValues(int[] hValues, int partitions)
+ {
+ Arrays.sort(hValues);
+
+ this.splits = new int[partitions];
+ int maxH = 0x7fffffff;
+ for (int i = 0; i < splits.length; i++) {
+ int quantile = (int) ((long) (i + 1) * hValues.length / partitions);
+ this.splits[i] = quantile == hValues.length ? maxH : hValues[quantile];
+ }
+ }
+
+ /**
+ * Gets the partition bounds.
+ *
+ * @return the partition bounds
+ */
+ public int[] getPartitionBounds()
+ {
+ return splits;
+ }
+
+ /**
* Gets the grids.
*
* @return the grids
diff --git a/core/src/main/java/org/datasyslab/geospark/spatialPartitioning/KDBTree.java b/core/src/main/java/org/apache/sedona/core/spatialPartitioning/KDBTree.java
similarity index 90%
rename from core/src/main/java/org/datasyslab/geospark/spatialPartitioning/KDBTree.java
rename to core/src/main/java/org/apache/sedona/core/spatialPartitioning/KDBTree.java
index 20433d9..93c5097 100644
--- a/core/src/main/java/org/datasyslab/geospark/spatialPartitioning/KDBTree.java
+++ b/core/src/main/java/org/apache/sedona/core/spatialPartitioning/KDBTree.java
@@ -1,21 +1,23 @@
/*
- * FILE: KDBTree
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.spatialPartitioning;
+package org.apache.sedona.core.spatialPartitioning;
import org.locationtech.jts.geom.Envelope;
@@ -149,17 +151,6 @@ public class KDBTree
return !r1.intersects(r2) && !r1.covers(r2) && !r2.covers(r1);
}
- public interface Visitor
- {
- /**
- * Visits a single node of the tree
- *
- * @param tree Node to visit
- * @return true to continue traversing the tree; false to stop
- */
- boolean visit(KDBTree tree);
- }
-
/**
* Traverses the tree top-down breadth-first and calls the visitor
* for each node. Stops traversing if a call to Visitor.visit returns false.
@@ -235,6 +226,52 @@ public class KDBTree
return true;
}
+ private void splitItems(Splitter splitter)
+ {
+ for (Envelope item : items) {
+ children[splitter.split(item) ? 0 : 1].insert(item);
+ }
+ }
+
+ private Envelope[] splitAtX(Envelope envelope, double x)
+ {
+ assert (envelope.getMinX() < x);
+ assert (envelope.getMaxX() > x);
+ Envelope[] splits = new Envelope[2];
+ splits[0] = new Envelope(envelope.getMinX(), x, envelope.getMinY(), envelope.getMaxY());
+ splits[1] = new Envelope(x, envelope.getMaxX(), envelope.getMinY(), envelope.getMaxY());
+ return splits;
+ }
+
+ private Envelope[] splitAtY(Envelope envelope, double y)
+ {
+ assert (envelope.getMinY() < y);
+ assert (envelope.getMaxY() > y);
+ Envelope[] splits = new Envelope[2];
+ splits[0] = new Envelope(envelope.getMinX(), envelope.getMaxX(), envelope.getMinY(), y);
+ splits[1] = new Envelope(envelope.getMinX(), envelope.getMaxX(), y, envelope.getMaxY());
+ return splits;
+ }
+
+ public interface Visitor
+ {
+ /**
+ * Visits a single node of the tree
+ *
+ * @param tree Node to visit
+ * @return true to continue traversing the tree; false to stop
+ */
+ boolean visit(KDBTree tree);
+ }
+
+ private interface Splitter
+ {
+ /**
+ * @return true if the specified envelope belongs to the lower split
+ */
+ boolean split(Envelope envelope);
+ }
+
private static final class XComparator
implements Comparator<Envelope>
{
@@ -257,14 +294,6 @@ public class KDBTree
}
}
- private interface Splitter
- {
- /**
- * @return true if the specified envelope belongs to the lower split
- */
- boolean split(Envelope envelope);
- }
-
private static final class XSplitter
implements Splitter
{
@@ -298,31 +327,4 @@ public class KDBTree
return envelope.getMinY() <= y;
}
}
-
- private void splitItems(Splitter splitter)
- {
- for (Envelope item : items) {
- children[splitter.split(item) ? 0 : 1].insert(item);
- }
- }
-
- private Envelope[] splitAtX(Envelope envelope, double x)
- {
- assert (envelope.getMinX() < x);
- assert (envelope.getMaxX() > x);
- Envelope[] splits = new Envelope[2];
- splits[0] = new Envelope(envelope.getMinX(), x, envelope.getMinY(), envelope.getMaxY());
- splits[1] = new Envelope(x, envelope.getMaxX(), envelope.getMinY(), envelope.getMaxY());
- return splits;
- }
-
- private Envelope[] splitAtY(Envelope envelope, double y)
- {
- assert (envelope.getMinY() < y);
- assert (envelope.getMaxY() > y);
- Envelope[] splits = new Envelope[2];
- splits[0] = new Envelope(envelope.getMinX(), envelope.getMaxX(), envelope.getMinY(), y);
- splits[1] = new Envelope(envelope.getMinX(), envelope.getMaxX(), y, envelope.getMaxY());
- return splits;
- }
}
diff --git a/core/src/main/java/org/datasyslab/geospark/spatialPartitioning/KDBTreePartitioner.java b/core/src/main/java/org/apache/sedona/core/spatialPartitioning/KDBTreePartitioner.java
similarity index 68%
rename from core/src/main/java/org/datasyslab/geospark/spatialPartitioning/KDBTreePartitioner.java
rename to core/src/main/java/org/apache/sedona/core/spatialPartitioning/KDBTreePartitioner.java
index ac686fd..3f85849 100644
--- a/core/src/main/java/org/datasyslab/geospark/spatialPartitioning/KDBTreePartitioner.java
+++ b/core/src/main/java/org/apache/sedona/core/spatialPartitioning/KDBTreePartitioner.java
@@ -1,28 +1,30 @@
/*
- * FILE: KDBTreePartitioner
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.spatialPartitioning;
+package org.apache.sedona.core.spatialPartitioning;
+import org.apache.sedona.core.enums.GridType;
+import org.apache.sedona.core.joinJudgement.DedupParams;
+import org.apache.sedona.core.utils.HalfOpenRectangle;
import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.Point;
-import org.datasyslab.geospark.enums.GridType;
-import org.datasyslab.geospark.joinJudgement.DedupParams;
-import org.datasyslab.geospark.utils.HalfOpenRectangle;
import scala.Tuple2;
import javax.annotation.Nullable;
@@ -46,6 +48,24 @@ public class KDBTreePartitioner
this.tree.dropElements();
}
+ private static List<Envelope> getLeafZones(KDBTree tree)
+ {
+ final List<Envelope> leafs = new ArrayList<>();
+ tree.traverse(new KDBTree.Visitor()
+ {
+ @Override
+ public boolean visit(KDBTree tree)
+ {
+ if (tree.isLeaf()) {
+ leafs.add(tree.getExtent());
+ }
+ return true;
+ }
+ });
+
+ return leafs;
+ }
+
@Override
public int numPartitions()
{
@@ -84,22 +104,4 @@ public class KDBTreePartitioner
{
return new DedupParams(grids);
}
-
- private static List<Envelope> getLeafZones(KDBTree tree)
- {
- final List<Envelope> leafs = new ArrayList<>();
- tree.traverse(new KDBTree.Visitor()
- {
- @Override
- public boolean visit(KDBTree tree)
- {
- if (tree.isLeaf()) {
- leafs.add(tree.getExtent());
- }
- return true;
- }
- });
-
- return leafs;
- }
}
diff --git a/core/src/main/java/org/datasyslab/geospark/spatialPartitioning/QuadtreePartitioning.java b/core/src/main/java/org/apache/sedona/core/spatialPartitioning/QuadtreePartitioning.java
similarity index 59%
rename from core/src/main/java/org/datasyslab/geospark/spatialPartitioning/QuadtreePartitioning.java
rename to core/src/main/java/org/apache/sedona/core/spatialPartitioning/QuadtreePartitioning.java
index 708ec69..e5a0397 100644
--- a/core/src/main/java/org/datasyslab/geospark/spatialPartitioning/QuadtreePartitioning.java
+++ b/core/src/main/java/org/apache/sedona/core/spatialPartitioning/QuadtreePartitioning.java
@@ -1,24 +1,27 @@
/*
- * FILE: QuadtreePartitioning
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.spatialPartitioning;
+package org.apache.sedona.core.spatialPartitioning;
+
+import org.apache.sedona.core.spatialPartitioning.quadtree.QuadRectangle;
+import org.apache.sedona.core.spatialPartitioning.quadtree.StandardQuadTree;
import org.locationtech.jts.geom.Envelope;
-import org.datasyslab.geospark.spatialPartitioning.quadtree.QuadRectangle;
-import org.datasyslab.geospark.spatialPartitioning.quadtree.StandardQuadTree;
import java.io.Serializable;
import java.util.List;
diff --git a/core/src/main/java/org/datasyslab/geospark/spatialPartitioning/RtreePartitioning.java b/core/src/main/java/org/apache/sedona/core/spatialPartitioning/RtreePartitioning.java
similarity index 58%
rename from core/src/main/java/org/datasyslab/geospark/spatialPartitioning/RtreePartitioning.java
rename to core/src/main/java/org/apache/sedona/core/spatialPartitioning/RtreePartitioning.java
index 6e34308..bace1ff 100644
--- a/core/src/main/java/org/datasyslab/geospark/spatialPartitioning/RtreePartitioning.java
+++ b/core/src/main/java/org/apache/sedona/core/spatialPartitioning/RtreePartitioning.java
@@ -1,20 +1,23 @@
/*
- * FILE: RtreePartitioning
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.spatialPartitioning;
+
+package org.apache.sedona.core.spatialPartitioning;
import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.index.strtree.STRtree;
diff --git a/core/src/main/java/org/datasyslab/geospark/spatialPartitioning/SpatialPartitioner.java b/core/src/main/java/org/apache/sedona/core/spatialPartitioning/SpatialPartitioner.java
similarity index 59%
rename from core/src/main/java/org/datasyslab/geospark/spatialPartitioning/SpatialPartitioner.java
rename to core/src/main/java/org/apache/sedona/core/spatialPartitioning/SpatialPartitioner.java
index a0737ae..baf9a7f 100644
--- a/core/src/main/java/org/datasyslab/geospark/spatialPartitioning/SpatialPartitioner.java
+++ b/core/src/main/java/org/apache/sedona/core/spatialPartitioning/SpatialPartitioner.java
@@ -1,26 +1,29 @@
/*
- * FILE: SpatialPartitioner
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.spatialPartitioning;
+package org.apache.sedona.core.spatialPartitioning;
+
+import org.apache.sedona.core.enums.GridType;
+import org.apache.sedona.core.joinJudgement.DedupParams;
+import org.apache.spark.Partitioner;
import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.Geometry;
-import org.apache.spark.Partitioner;
-import org.datasyslab.geospark.enums.GridType;
-import org.datasyslab.geospark.joinJudgement.DedupParams;
import scala.Tuple2;
import javax.annotation.Nullable;
diff --git a/core/src/main/java/org/datasyslab/geospark/spatialPartitioning/VoronoiPartitioning.java b/core/src/main/java/org/apache/sedona/core/spatialPartitioning/VoronoiPartitioning.java
similarity index 72%
rename from core/src/main/java/org/datasyslab/geospark/spatialPartitioning/VoronoiPartitioning.java
rename to core/src/main/java/org/apache/sedona/core/spatialPartitioning/VoronoiPartitioning.java
index 94fec11..4c2c7d9 100644
--- a/core/src/main/java/org/datasyslab/geospark/spatialPartitioning/VoronoiPartitioning.java
+++ b/core/src/main/java/org/apache/sedona/core/spatialPartitioning/VoronoiPartitioning.java
@@ -1,20 +1,23 @@
/*
- * FILE: VoronoiPartitioning
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.spatialPartitioning;
+
+package org.apache.sedona.core.spatialPartitioning;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Envelope;
diff --git a/core/src/main/java/org/apache/sedona/core/spatialPartitioning/quadtree/QuadNode.java b/core/src/main/java/org/apache/sedona/core/spatialPartitioning/quadtree/QuadNode.java
new file mode 100644
index 0000000..a55741f
--- /dev/null
+++ b/core/src/main/java/org/apache/sedona/core/spatialPartitioning/quadtree/QuadNode.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.spatialPartitioning.quadtree;
+
+import java.io.Serializable;
+
+public class QuadNode<T>
+ implements Serializable
+{
+ QuadRectangle r;
+ T element;
+
+ QuadNode(QuadRectangle r, T element)
+ {
+ this.r = r;
+ this.element = element;
+ }
+
+ @Override
+ public String toString()
+ {
+ return r.toString();
+ }
+}
diff --git a/core/src/main/java/org/datasyslab/geospark/spatialPartitioning/quadtree/QuadRectangle.java b/core/src/main/java/org/apache/sedona/core/spatialPartitioning/quadtree/QuadRectangle.java
similarity index 71%
rename from core/src/main/java/org/datasyslab/geospark/spatialPartitioning/quadtree/QuadRectangle.java
rename to core/src/main/java/org/apache/sedona/core/spatialPartitioning/quadtree/QuadRectangle.java
index fd0ee8a..129688e 100644
--- a/core/src/main/java/org/datasyslab/geospark/spatialPartitioning/quadtree/QuadRectangle.java
+++ b/core/src/main/java/org/apache/sedona/core/spatialPartitioning/quadtree/QuadRectangle.java
@@ -1,20 +1,23 @@
/*
- * FILE: QuadRectangle
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.spatialPartitioning.quadtree;
+
+package org.apache.sedona.core.spatialPartitioning.quadtree;
import org.locationtech.jts.geom.Envelope;
@@ -92,7 +95,7 @@ public class QuadRectangle
@Override
public String toString()
{
- return "x: " + x + " y: " + y + " w: " + width + " h: " + height + " PartitionId: " + partitionId + " Lineage: " +lineage;
+ return "x: " + x + " y: " + y + " w: " + width + " h: " + height + " PartitionId: " + partitionId + " Lineage: " + lineage;
}
@Override
diff --git a/core/src/main/java/org/datasyslab/geospark/spatialPartitioning/quadtree/QuadTreePartitioner.java b/core/src/main/java/org/apache/sedona/core/spatialPartitioning/quadtree/QuadTreePartitioner.java
similarity index 69%
rename from core/src/main/java/org/datasyslab/geospark/spatialPartitioning/quadtree/QuadTreePartitioner.java
rename to core/src/main/java/org/apache/sedona/core/spatialPartitioning/quadtree/QuadTreePartitioner.java
index a24659b..de92a49 100644
--- a/core/src/main/java/org/datasyslab/geospark/spatialPartitioning/quadtree/QuadTreePartitioner.java
+++ b/core/src/main/java/org/apache/sedona/core/spatialPartitioning/quadtree/QuadTreePartitioner.java
@@ -1,28 +1,31 @@
/*
- * FILE: QuadTreePartitioner
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.spatialPartitioning.quadtree;
+package org.apache.sedona.core.spatialPartitioning.quadtree;
+
+import org.apache.sedona.core.enums.GridType;
+import org.apache.sedona.core.joinJudgement.DedupParams;
+import org.apache.sedona.core.spatialPartitioning.SpatialPartitioner;
+import org.apache.sedona.core.utils.HalfOpenRectangle;
import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.Point;
-import org.datasyslab.geospark.enums.GridType;
-import org.datasyslab.geospark.joinJudgement.DedupParams;
-import org.datasyslab.geospark.spatialPartitioning.SpatialPartitioner;
-import org.datasyslab.geospark.utils.HalfOpenRectangle;
import scala.Tuple2;
import javax.annotation.Nullable;
@@ -37,7 +40,7 @@ import java.util.Set;
public class QuadTreePartitioner
extends SpatialPartitioner
{
- private StandardQuadTree<? extends Geometry> quadTree;
+ private final StandardQuadTree<? extends Geometry> quadTree;
public QuadTreePartitioner(StandardQuadTree<? extends Geometry> quadTree)
{
@@ -49,6 +52,19 @@ public class QuadTreePartitioner
this.quadTree.dropElements();
}
+ private static List<Envelope> getLeafGrids(StandardQuadTree<? extends Geometry> quadTree)
+ {
+ Objects.requireNonNull(quadTree, "quadTree");
+
+ final List<QuadRectangle> zones = quadTree.getLeafZones();
+ final List<Envelope> grids = new ArrayList<>();
+ for (QuadRectangle zone : zones) {
+ grids.add(zone.getEnvelope());
+ }
+
+ return grids;
+ }
+
@Override
public <T extends Geometry> Iterator<Tuple2<Integer, T>> placeObject(T spatialObject)
throws Exception
@@ -97,17 +113,4 @@ public class QuadTreePartitioner
final QuadTreePartitioner other = (QuadTreePartitioner) o;
return other.quadTree.equals(this.quadTree);
}
-
- private static List<Envelope> getLeafGrids(StandardQuadTree<? extends Geometry> quadTree)
- {
- Objects.requireNonNull(quadTree, "quadTree");
-
- final List<QuadRectangle> zones = quadTree.getLeafZones();
- final List<Envelope> grids = new ArrayList<>();
- for (QuadRectangle zone : zones) {
- grids.add(zone.getEnvelope());
- }
-
- return grids;
- }
}
diff --git a/core/src/main/java/org/datasyslab/geospark/spatialPartitioning/quadtree/StandardQuadTree.java b/core/src/main/java/org/apache/sedona/core/spatialPartitioning/quadtree/StandardQuadTree.java
similarity index 86%
rename from core/src/main/java/org/datasyslab/geospark/spatialPartitioning/quadtree/StandardQuadTree.java
rename to core/src/main/java/org/apache/sedona/core/spatialPartitioning/quadtree/StandardQuadTree.java
index 157058e..1cf4c43 100644
--- a/core/src/main/java/org/datasyslab/geospark/spatialPartitioning/quadtree/StandardQuadTree.java
+++ b/core/src/main/java/org/apache/sedona/core/spatialPartitioning/quadtree/StandardQuadTree.java
@@ -1,23 +1,26 @@
/*
- * FILE: StandardQuadTree
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.spatialPartitioning.quadtree;
-import org.locationtech.jts.geom.Envelope;
+package org.apache.sedona.core.spatialPartitioning.quadtree;
+
import org.apache.commons.lang3.mutable.MutableInt;
+import org.locationtech.jts.geom.Envelope;
import java.io.Serializable;
import java.util.ArrayList;
@@ -26,28 +29,23 @@ import java.util.List;
public class StandardQuadTree<T>
implements Serializable
{
+ public static final int REGION_SELF = -1;
+ public static final int REGION_NW = 0;
+ public static final int REGION_NE = 1;
+ public static final int REGION_SW = 2;
+ public static final int REGION_SE = 3;
// Maximum number of items in any given zone. When reached, a zone is sub-divided.
private final int maxItemsPerZone;
private final int maxLevel;
-
private final int level;
- private int nodeNum = 0;
-
- // the four sub regions,
- // may be null if not needed
- private StandardQuadTree<T>[] regions;
-
// the current nodes
private final List<QuadNode<T>> nodes = new ArrayList<>();
-
// current rectangle zone
private final QuadRectangle zone;
-
- public static final int REGION_SELF = -1;
- public static final int REGION_NW = 0;
- public static final int REGION_NE = 1;
- public static final int REGION_SW = 2;
- public static final int REGION_SE = 3;
+ private int nodeNum = 0;
+ // the four sub regions,
+ // may be null if not needed
+ private StandardQuadTree<T>[] regions;
public StandardQuadTree(QuadRectangle definition, int level)
{
@@ -226,28 +224,6 @@ public class StandardQuadTree<T>
return list;
}
- private interface Visitor<T>
- {
- /**
- * Visits a single node of the tree
- *
- * @param tree Node to visit
- * @return true to continue traversing the tree; false to stop
- */
- boolean visit(StandardQuadTree<T> tree);
- }
-
- private interface VisitorWithLineage<T>
- {
- /**
- * Visits a single node of the tree, with the traversal trace
- *
- * @param tree Node to visit
- * @return true to continue traversing the tree; false to stop
- */
- boolean visit(StandardQuadTree<T> tree, String lineage);
- }
-
/**
* Traverses the tree top-down breadth-first and calls the visitor
* for each node. Stops traversing if a call to Visitor.visit returns false.
@@ -278,10 +254,10 @@ public class StandardQuadTree<T>
}
if (regions != null) {
- regions[REGION_NW].traverseWithTrace(visitor, lineage+REGION_NW);
- regions[REGION_NE].traverseWithTrace(visitor, lineage+REGION_NE);
- regions[REGION_SW].traverseWithTrace(visitor, lineage+REGION_SW);
- regions[REGION_SE].traverseWithTrace(visitor, lineage+REGION_SE);
+ regions[REGION_NW].traverseWithTrace(visitor, lineage + REGION_NW);
+ regions[REGION_NE].traverseWithTrace(visitor, lineage + REGION_NE);
+ regions[REGION_SW].traverseWithTrace(visitor, lineage + REGION_SW);
+ regions[REGION_SE].traverseWithTrace(visitor, lineage + REGION_SE);
}
}
@@ -376,7 +352,7 @@ public class StandardQuadTree<T>
return this.zone;
}
- throw new ArrayIndexOutOfBoundsException("[GeoSparkViz][StandardQuadTree] this pixel is out of the quad tree boundary.");
+ throw new ArrayIndexOutOfBoundsException("[Sedona][StandardQuadTree] this pixel is out of the quad tree boundary.");
}
}
@@ -392,12 +368,12 @@ public class StandardQuadTree<T>
assert regions == null;
if (zone.contains(x, y)) {
// This should not happen
- throw new Exception("[GeoSparkViz][StandardQuadTree][getParentZone] this leaf node doesn't have enough depth. " +
+ throw new Exception("[Sedona][StandardQuadTree][getParentZone] this leaf node doesn't have enough depth. " +
"Please check ForceGrowUp. Expected: " + minLevel + " Actual: " + level + ". Query point: " + x + " " + y +
". Tree statistics, total leaf nodes: " + getTotalNumLeafNode());
}
else {
- throw new Exception("[GeoSparkViz][StandardQuadTree][getParentZone] this pixel is out of the quad tree boundary.");
+ throw new Exception("[Sedona][StandardQuadTree][getParentZone] this pixel is out of the quad tree boundary.");
}
}
else {
@@ -408,7 +384,7 @@ public class StandardQuadTree<T>
return zone;
}
- throw new Exception("[GeoSparkViz][StandardQuadTree][getParentZone] this pixel is out of the quad tree boundary.");
+ throw new Exception("[Sedona][StandardQuadTree][getParentZone] this pixel is out of the quad tree boundary.");
}
public List<QuadRectangle> findZones(QuadRectangle r)
@@ -446,6 +422,7 @@ public class StandardQuadTree<T>
traverse(new Visitor<T>()
{
private int partitionId = 0;
+
@Override
public boolean visit(StandardQuadTree<T> tree)
{
@@ -472,4 +449,26 @@ public class StandardQuadTree<T>
}
}, "");
}
+
+ private interface Visitor<T>
+ {
+ /**
+ * Visits a single node of the tree
+ *
+ * @param tree Node to visit
+ * @return true to continue traversing the tree; false to stop
+ */
+ boolean visit(StandardQuadTree<T> tree);
+ }
+
+ private interface VisitorWithLineage<T>
+ {
+ /**
+ * Visits a single node of the tree, with the traversal trace
+ *
+ * @param tree Node to visit
+ * @return true to continue traversing the tree; false to stop
+ */
+ boolean visit(StandardQuadTree<T> tree, String lineage);
+ }
}
diff --git a/core/src/main/java/org/datasyslab/geospark/spatialRDD/CircleRDD.java b/core/src/main/java/org/apache/sedona/core/spatialRDD/CircleRDD.java
similarity index 79%
rename from core/src/main/java/org/datasyslab/geospark/spatialRDD/CircleRDD.java
rename to core/src/main/java/org/apache/sedona/core/spatialRDD/CircleRDD.java
index 58d5068..959f2f7 100644
--- a/core/src/main/java/org/datasyslab/geospark/spatialRDD/CircleRDD.java
+++ b/core/src/main/java/org/apache/sedona/core/spatialRDD/CircleRDD.java
@@ -1,28 +1,31 @@
/*
- * FILE: CircleRDD
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.spatialRDD;
+package org.apache.sedona.core.spatialRDD;
+
+import org.apache.sedona.core.geometryObjects.Circle;
+import org.apache.spark.api.java.JavaRDD;
+import org.apache.spark.api.java.function.Function;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.LineString;
import org.locationtech.jts.geom.Point;
import org.locationtech.jts.geom.Polygon;
-import org.apache.spark.api.java.JavaRDD;
-import org.apache.spark.api.java.function.Function;
-import org.datasyslab.geospark.geometryObjects.Circle;
// TODO: Auto-generated Javadoc
diff --git a/core/src/main/java/org/datasyslab/geospark/spatialRDD/LineStringRDD.java b/core/src/main/java/org/apache/sedona/core/spatialRDD/LineStringRDD.java
similarity index 95%
rename from core/src/main/java/org/datasyslab/geospark/spatialRDD/LineStringRDD.java
rename to core/src/main/java/org/apache/sedona/core/spatialRDD/LineStringRDD.java
index 72345e0..25bc7b1 100644
--- a/core/src/main/java/org/datasyslab/geospark/spatialRDD/LineStringRDD.java
+++ b/core/src/main/java/org/apache/sedona/core/spatialRDD/LineStringRDD.java
@@ -1,30 +1,33 @@
/*
- * FILE: LineStringRDD
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.spatialRDD;
-import org.locationtech.jts.geom.Envelope;
-import org.locationtech.jts.geom.LineString;
+package org.apache.sedona.core.spatialRDD;
+
+import org.apache.sedona.core.enums.FileDataSplitter;
+import org.apache.sedona.core.formatMapper.FormatMapper;
+import org.apache.sedona.core.formatMapper.LineStringFormatMapper;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.api.java.function.FlatMapFunction;
import org.apache.spark.storage.StorageLevel;
-import org.datasyslab.geospark.enums.FileDataSplitter;
-import org.datasyslab.geospark.formatMapper.FormatMapper;
-import org.datasyslab.geospark.formatMapper.LineStringFormatMapper;
+import org.locationtech.jts.geom.Envelope;
+import org.locationtech.jts.geom.LineString;
// TODO: Auto-generated Javadoc
@@ -36,9 +39,8 @@ public class LineStringRDD
{
/**
* Instantiates a new line string RDD.
- *
*/
- public LineStringRDD(){}
+ public LineStringRDD() {}
/**
* Instantiates a new line string RDD.
diff --git a/core/src/main/java/org/datasyslab/geospark/spatialRDD/PointRDD.java b/core/src/main/java/org/apache/sedona/core/spatialRDD/PointRDD.java
similarity index 95%
rename from core/src/main/java/org/datasyslab/geospark/spatialRDD/PointRDD.java
rename to core/src/main/java/org/apache/sedona/core/spatialRDD/PointRDD.java
index d8b549d..c4409b5 100644
--- a/core/src/main/java/org/datasyslab/geospark/spatialRDD/PointRDD.java
+++ b/core/src/main/java/org/apache/sedona/core/spatialRDD/PointRDD.java
@@ -1,30 +1,33 @@
/*
- * FILE: PointRDD
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.spatialRDD;
-import org.locationtech.jts.geom.Envelope;
-import org.locationtech.jts.geom.Point;
+package org.apache.sedona.core.spatialRDD;
+
+import org.apache.sedona.core.enums.FileDataSplitter;
+import org.apache.sedona.core.formatMapper.FormatMapper;
+import org.apache.sedona.core.formatMapper.PointFormatMapper;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.api.java.function.FlatMapFunction;
import org.apache.spark.storage.StorageLevel;
-import org.datasyslab.geospark.enums.FileDataSplitter;
-import org.datasyslab.geospark.formatMapper.FormatMapper;
-import org.datasyslab.geospark.formatMapper.PointFormatMapper;
+import org.locationtech.jts.geom.Envelope;
+import org.locationtech.jts.geom.Point;
// TODO: Auto-generated Javadoc
diff --git a/core/src/main/java/org/datasyslab/geospark/spatialRDD/PolygonRDD.java b/core/src/main/java/org/apache/sedona/core/spatialRDD/PolygonRDD.java
similarity index 95%
rename from core/src/main/java/org/datasyslab/geospark/spatialRDD/PolygonRDD.java
rename to core/src/main/java/org/apache/sedona/core/spatialRDD/PolygonRDD.java
index 74154b6..1df7563 100644
--- a/core/src/main/java/org/datasyslab/geospark/spatialRDD/PolygonRDD.java
+++ b/core/src/main/java/org/apache/sedona/core/spatialRDD/PolygonRDD.java
@@ -1,21 +1,32 @@
/*
- * FILE: PolygonRDD
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.spatialRDD;
+package org.apache.sedona.core.spatialRDD;
+
+import org.apache.sedona.core.enums.FileDataSplitter;
+import org.apache.sedona.core.formatMapper.FormatMapper;
+import org.apache.sedona.core.formatMapper.PolygonFormatMapper;
+import org.apache.spark.api.java.JavaRDD;
+import org.apache.spark.api.java.JavaSparkContext;
+import org.apache.spark.api.java.function.FlatMapFunction;
+import org.apache.spark.api.java.function.Function2;
+import org.apache.spark.storage.StorageLevel;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.Geometry;
@@ -24,14 +35,6 @@ import org.locationtech.jts.geom.LinearRing;
import org.locationtech.jts.geom.Polygon;
import org.locationtech.jts.geom.PrecisionModel;
import org.locationtech.jts.precision.GeometryPrecisionReducer;
-import org.apache.spark.api.java.JavaRDD;
-import org.apache.spark.api.java.JavaSparkContext;
-import org.apache.spark.api.java.function.FlatMapFunction;
-import org.apache.spark.api.java.function.Function2;
-import org.apache.spark.storage.StorageLevel;
-import org.datasyslab.geospark.enums.FileDataSplitter;
-import org.datasyslab.geospark.formatMapper.FormatMapper;
-import org.datasyslab.geospark.formatMapper.PolygonFormatMapper;
import java.util.ArrayList;
import java.util.Arrays;
diff --git a/core/src/main/java/org/datasyslab/geospark/spatialRDD/RectangleRDD.java b/core/src/main/java/org/apache/sedona/core/spatialRDD/RectangleRDD.java
similarity index 95%
rename from core/src/main/java/org/datasyslab/geospark/spatialRDD/RectangleRDD.java
rename to core/src/main/java/org/apache/sedona/core/spatialRDD/RectangleRDD.java
index a3694b9..6b03ff4 100644
--- a/core/src/main/java/org/datasyslab/geospark/spatialRDD/RectangleRDD.java
+++ b/core/src/main/java/org/apache/sedona/core/spatialRDD/RectangleRDD.java
@@ -1,29 +1,32 @@
/*
- * FILE: RectangleRDD
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.spatialRDD;
-import org.locationtech.jts.geom.Envelope;
-import org.locationtech.jts.geom.Polygon;
+package org.apache.sedona.core.spatialRDD;
+
+import org.apache.sedona.core.enums.FileDataSplitter;
+import org.apache.sedona.core.formatMapper.RectangleFormatMapper;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.api.java.function.FlatMapFunction;
import org.apache.spark.storage.StorageLevel;
-import org.datasyslab.geospark.enums.FileDataSplitter;
-import org.datasyslab.geospark.formatMapper.RectangleFormatMapper;
+import org.locationtech.jts.geom.Envelope;
+import org.locationtech.jts.geom.Polygon;
// TODO: Auto-generated Javadoc
@@ -36,9 +39,8 @@ public class RectangleRDD
{
/**
* Instantiates a new rectangle RDD.
- *
*/
- public RectangleRDD(){}
+ public RectangleRDD() {}
/**
* Instantiates a new rectangle RDD.
diff --git a/core/src/main/java/org/datasyslab/geospark/spatialRDD/SpatialRDD.java b/core/src/main/java/org/apache/sedona/core/spatialRDD/SpatialRDD.java
similarity index 90%
rename from core/src/main/java/org/datasyslab/geospark/spatialRDD/SpatialRDD.java
rename to core/src/main/java/org/apache/sedona/core/spatialRDD/SpatialRDD.java
index 7f4f623..d076c22 100644
--- a/core/src/main/java/org/datasyslab/geospark/spatialRDD/SpatialRDD.java
+++ b/core/src/main/java/org/apache/sedona/core/spatialRDD/SpatialRDD.java
@@ -1,32 +1,42 @@
/*
- * FILE: SpatialRDD
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.spatialRDD;
-import org.locationtech.jts.geom.Coordinate;
-import org.locationtech.jts.geom.Envelope;
-import org.locationtech.jts.geom.Geometry;
-import org.locationtech.jts.geom.GeometryFactory;
-import org.locationtech.jts.geom.LinearRing;
-import org.locationtech.jts.geom.Polygon;
-import org.locationtech.jts.index.SpatialIndex;
-import org.locationtech.jts.io.WKBWriter;
-import org.locationtech.jts.io.WKTWriter;
+package org.apache.sedona.core.spatialRDD;
+
import org.apache.commons.lang.NullArgumentException;
import org.apache.log4j.Logger;
+import org.apache.sedona.core.enums.GridType;
+import org.apache.sedona.core.enums.IndexType;
+import org.apache.sedona.core.spatialPartitioning.EqualPartitioning;
+import org.apache.sedona.core.spatialPartitioning.FlatGridPartitioner;
+import org.apache.sedona.core.spatialPartitioning.HilbertPartitioning;
+import org.apache.sedona.core.spatialPartitioning.KDBTree;
+import org.apache.sedona.core.spatialPartitioning.KDBTreePartitioner;
+import org.apache.sedona.core.spatialPartitioning.QuadtreePartitioning;
+import org.apache.sedona.core.spatialPartitioning.RtreePartitioning;
+import org.apache.sedona.core.spatialPartitioning.SpatialPartitioner;
+import org.apache.sedona.core.spatialPartitioning.VoronoiPartitioning;
+import org.apache.sedona.core.spatialPartitioning.quadtree.QuadTreePartitioner;
+import org.apache.sedona.core.spatialPartitioning.quadtree.StandardQuadTree;
+import org.apache.sedona.core.spatialRddTool.IndexBuilder;
+import org.apache.sedona.core.spatialRddTool.StatCalculator;
+import org.apache.sedona.core.utils.RDDSampleUtils;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.function.FlatMapFunction;
import org.apache.spark.api.java.function.Function;
@@ -34,24 +44,17 @@ import org.apache.spark.api.java.function.Function2;
import org.apache.spark.api.java.function.PairFlatMapFunction;
import org.apache.spark.storage.StorageLevel;
import org.apache.spark.util.random.SamplingUtils;
-import org.datasyslab.geospark.enums.GridType;
-import org.datasyslab.geospark.enums.IndexType;
-import org.datasyslab.geospark.spatialPartitioning.EqualPartitioning;
-import org.datasyslab.geospark.spatialPartitioning.FlatGridPartitioner;
-import org.datasyslab.geospark.spatialPartitioning.HilbertPartitioning;
-import org.datasyslab.geospark.spatialPartitioning.KDBTree;
-import org.datasyslab.geospark.spatialPartitioning.KDBTreePartitioner;
-import org.datasyslab.geospark.spatialPartitioning.QuadtreePartitioning;
-import org.datasyslab.geospark.spatialPartitioning.RtreePartitioning;
-import org.datasyslab.geospark.spatialPartitioning.SpatialPartitioner;
-import org.datasyslab.geospark.spatialPartitioning.VoronoiPartitioning;
-import org.datasyslab.geospark.spatialPartitioning.quadtree.QuadTreePartitioner;
-import org.datasyslab.geospark.spatialPartitioning.quadtree.StandardQuadTree;
-import org.datasyslab.geospark.spatialRddTool.IndexBuilder;
-import org.datasyslab.geospark.spatialRddTool.StatCalculator;
-import org.datasyslab.geospark.utils.RDDSampleUtils;
import org.geotools.geometry.jts.JTS;
import org.geotools.referencing.CRS;
+import org.locationtech.jts.geom.Coordinate;
+import org.locationtech.jts.geom.Envelope;
+import org.locationtech.jts.geom.Geometry;
+import org.locationtech.jts.geom.GeometryFactory;
+import org.locationtech.jts.geom.LinearRing;
+import org.locationtech.jts.geom.Polygon;
+import org.locationtech.jts.index.SpatialIndex;
+import org.locationtech.jts.io.WKBWriter;
+import org.locationtech.jts.io.WKTWriter;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.operation.MathTransform;
@@ -117,9 +120,20 @@ public class SpatialRDD<T extends Geometry>
public List<Envelope> grids;
public StandardQuadTree partitionTree;
-
+ public List<String> fieldNames;
+ /**
+ * The CR stransformation.
+ */
+ protected boolean CRStransformation = false;
+ /**
+ * The source epsg code.
+ */
+ protected String sourceEpsgCode = "";
+ /**
+ * The target epgsg code.
+ */
+ protected String targetEpgsgCode = "";
private SpatialPartitioner partitioner;
-
/**
* The sample number.
*/
@@ -130,8 +144,6 @@ public class SpatialRDD<T extends Geometry>
return sampleNumber;
}
- public List<String> fieldNames;
-
/**
* Sets the sample number.
*
@@ -143,33 +155,17 @@ public class SpatialRDD<T extends Geometry>
}
/**
- * The CR stransformation.
- */
- protected boolean CRStransformation = false;
- ;
-
- /**
- * The source epsg code.
- */
- protected String sourceEpsgCode = "";
-
- /**
- * The target epgsg code.
- */
- protected String targetEpgsgCode = "";
-
- /**
* CRS transform.
*
* @param sourceEpsgCRSCode the source epsg CRS code
* @param targetEpsgCRSCode the target epsg CRS code
* @param lenient consider the difference of the geodetic datum between the two coordinate systems,
- * if {@code true}, never throw an exception "Bursa-Wolf Parameters Required", but not
- * recommended for careful analysis work
- *
+ * if {@code true}, never throw an exception "Bursa-Wolf Parameters Required", but not
+ * recommended for careful analysis work
* @return true, if successful
*/
- public boolean CRSTransform(String sourceEpsgCRSCode, String targetEpsgCRSCode, boolean lenient){
+ public boolean CRSTransform(String sourceEpsgCRSCode, String targetEpsgCRSCode, boolean lenient)
+ {
try {
CoordinateReferenceSystem sourceCRS = CRS.decode(sourceEpsgCRSCode);
CoordinateReferenceSystem targetCRS = CRS.decode(targetEpsgCRSCode);
@@ -543,7 +539,7 @@ public class SpatialRDD<T extends Geometry>
*/
public void saveAsWKB(String outputLocation)
{
- if (this.rawSpatialRDD == null){
+ if (this.rawSpatialRDD == null) {
throw new NullArgumentException("save as WKB cannot operate on null RDD");
}
this.rawSpatialRDD.mapPartitions(new FlatMapFunction<Iterator<T>, String>()
@@ -554,11 +550,11 @@ public class SpatialRDD<T extends Geometry>
{
WKBWriter writer = new WKBWriter(3, true);
ArrayList<String> wkbs = new ArrayList<>();
-
+
while (iterator.hasNext()) {
Geometry spatialObject = iterator.next();
String wkb = WKBWriter.toHex(writer.write(spatialObject));
-
+
if (spatialObject.getUserData() != null) {
wkbs.add(wkb + "\t" + spatialObject.getUserData());
}
@@ -573,11 +569,10 @@ public class SpatialRDD<T extends Geometry>
/**
* Save as WKT
- *
*/
public void saveAsWKT(String outputLocation)
{
- if (this.rawSpatialRDD == null){
+ if (this.rawSpatialRDD == null) {
throw new NullArgumentException("save as WKT cannot operate on null RDD");
}
this.rawSpatialRDD.mapPartitions(new FlatMapFunction<Iterator<T>, String>()
@@ -621,7 +616,7 @@ public class SpatialRDD<T extends Geometry>
ArrayList<String> result = new ArrayList();
GeoJSONWriter writer = new GeoJSONWriter();
while (iterator.hasNext()) {
- Geometry spatialObject = (Geometry) iterator.next();
+ Geometry spatialObject = iterator.next();
Feature jsonFeature;
if (spatialObject.getUserData() != null) {
Map<String, Object> userData = new HashMap<String, Object>();
diff --git a/core/src/main/java/org/datasyslab/geospark/spatialRddTool/IndexBuilder.java b/core/src/main/java/org/apache/sedona/core/spatialRddTool/IndexBuilder.java
similarity index 59%
rename from core/src/main/java/org/datasyslab/geospark/spatialRddTool/IndexBuilder.java
rename to core/src/main/java/org/apache/sedona/core/spatialRddTool/IndexBuilder.java
index 1fb181e..3b3d34e 100644
--- a/core/src/main/java/org/datasyslab/geospark/spatialRddTool/IndexBuilder.java
+++ b/core/src/main/java/org/apache/sedona/core/spatialRddTool/IndexBuilder.java
@@ -1,29 +1,31 @@
/*
- * FILE: IndexBuilder
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.spatialRddTool;
+package org.apache.sedona.core.spatialRddTool;
+import org.apache.sedona.core.enums.IndexType;
+import org.apache.spark.api.java.function.FlatMapFunction;
import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.index.SpatialIndex;
import org.locationtech.jts.index.quadtree.Quadtree;
import org.locationtech.jts.index.strtree.STRtree;
-import org.apache.spark.api.java.function.FlatMapFunction;
-import org.datasyslab.geospark.enums.IndexType;
import java.util.HashSet;
import java.util.Iterator;
diff --git a/core/src/main/java/org/datasyslab/geospark/spatialRddTool/StatCalculator.java b/core/src/main/java/org/apache/sedona/core/spatialRddTool/StatCalculator.java
similarity index 67%
rename from core/src/main/java/org/datasyslab/geospark/spatialRddTool/StatCalculator.java
rename to core/src/main/java/org/apache/sedona/core/spatialRddTool/StatCalculator.java
index ed37f86..70c0399 100644
--- a/core/src/main/java/org/datasyslab/geospark/spatialRddTool/StatCalculator.java
+++ b/core/src/main/java/org/apache/sedona/core/spatialRddTool/StatCalculator.java
@@ -1,21 +1,23 @@
/*
- * FILE: StatCalculator
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.spatialRddTool;
+package org.apache.sedona.core.spatialRddTool;
import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.Geometry;
@@ -26,8 +28,8 @@ import java.util.Objects;
public class StatCalculator
implements Serializable
{
- private Envelope boundary;
- private long count;
+ private final Envelope boundary;
+ private final long count;
public StatCalculator(Envelope boundary, long count)
{
diff --git a/core/src/main/java/org/datasyslab/geospark/utils/CRSTransformation.java b/core/src/main/java/org/apache/sedona/core/utils/CRSTransformation.java
similarity index 85%
rename from core/src/main/java/org/datasyslab/geospark/utils/CRSTransformation.java
rename to core/src/main/java/org/apache/sedona/core/utils/CRSTransformation.java
index 1d67900..c24417d 100644
--- a/core/src/main/java/org/datasyslab/geospark/utils/CRSTransformation.java
+++ b/core/src/main/java/org/apache/sedona/core/utils/CRSTransformation.java
@@ -1,27 +1,30 @@
/*
- * FILE: CRSTransformation
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.utils;
+package org.apache.sedona.core.utils;
+
+import org.geotools.geometry.jts.JTS;
+import org.geotools.referencing.CRS;
import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.Point;
import org.locationtech.jts.geom.Polygon;
-import org.geotools.geometry.jts.JTS;
-import org.geotools.referencing.CRS;
import org.opengis.geometry.MismatchedDimensionException;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
diff --git a/core/src/main/java/org/apache/sedona/core/utils/HalfOpenRectangle.java b/core/src/main/java/org/apache/sedona/core/utils/HalfOpenRectangle.java
new file mode 100644
index 0000000..560bac4
--- /dev/null
+++ b/core/src/main/java/org/apache/sedona/core/utils/HalfOpenRectangle.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.utils;
+
+import org.locationtech.jts.geom.Envelope;
+import org.locationtech.jts.geom.Point;
+
+public class HalfOpenRectangle
+{
+ private final Envelope envelope;
+
+ public HalfOpenRectangle(Envelope envelope)
+ {
+ this.envelope = envelope;
+ }
+
+ public boolean contains(Point point)
+ {
+ return contains(point.getX(), point.getY());
+ }
+
+ public boolean contains(double x, double y)
+ {
+ return x >= envelope.getMinX() && x < envelope.getMaxX()
+ && y >= envelope.getMinY() && y < envelope.getMaxY();
+ }
+
+ public Envelope getEnvelope()
+ {
+ return envelope;
+ }
+}
diff --git a/core/src/main/java/org/datasyslab/geospark/utils/RDDSampleUtils.java b/core/src/main/java/org/apache/sedona/core/utils/RDDSampleUtils.java
similarity index 59%
rename from core/src/main/java/org/datasyslab/geospark/utils/RDDSampleUtils.java
rename to core/src/main/java/org/apache/sedona/core/utils/RDDSampleUtils.java
index 97f2f21..6e8f4af 100644
--- a/core/src/main/java/org/datasyslab/geospark/utils/RDDSampleUtils.java
+++ b/core/src/main/java/org/apache/sedona/core/utils/RDDSampleUtils.java
@@ -1,20 +1,23 @@
/*
- * FILE: RDDSampleUtils
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.utils;
+
+package org.apache.sedona.core.utils;
// TODO: Auto-generated Javadoc
@@ -47,14 +50,14 @@ public class RDDSampleUtils
{
if (givenSampleNumbers > 0) {
if (givenSampleNumbers > totalNumberOfRecords) {
- throw new IllegalArgumentException("[GeoSpark] Number of samples " + givenSampleNumbers + " cannot be larger than total records num " + totalNumberOfRecords);
+ throw new IllegalArgumentException("[Sedona] Number of samples " + givenSampleNumbers + " cannot be larger than total records num " + totalNumberOfRecords);
}
return givenSampleNumbers;
}
// Make sure that number of records >= 2 * number of partitions
if (totalNumberOfRecords < 2 * numPartitions) {
- throw new IllegalArgumentException("[GeoSpark] Number of partitions " + numPartitions + " cannot be larger than half of total records num " + totalNumberOfRecords);
+ throw new IllegalArgumentException("[Sedona] Number of partitions " + numPartitions + " cannot be larger than half of total records num " + totalNumberOfRecords);
}
if (totalNumberOfRecords < 1000) {
diff --git a/core/src/main/java/org/datasyslab/geospark/utils/GeoSparkConf.java b/core/src/main/java/org/apache/sedona/core/utils/SedonaConf.java
similarity index 64%
rename from core/src/main/java/org/datasyslab/geospark/utils/GeoSparkConf.java
rename to core/src/main/java/org/apache/sedona/core/utils/SedonaConf.java
index 4b6fefc..6f3f52e 100644
--- a/core/src/main/java/org/datasyslab/geospark/utils/GeoSparkConf.java
+++ b/core/src/main/java/org/apache/sedona/core/utils/SedonaConf.java
@@ -1,36 +1,39 @@
/*
- * FILE: GeoSparkConf
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.utils;
-import org.locationtech.jts.geom.Envelope;
+package org.apache.sedona.core.utils;
+
+import org.apache.sedona.core.enums.GridType;
+import org.apache.sedona.core.enums.IndexType;
+import org.apache.sedona.core.enums.JoinBuildSide;
+import org.apache.sedona.core.enums.JoinSparitionDominantSide;
import org.apache.spark.SparkConf;
-import org.datasyslab.geospark.enums.GridType;
-import org.datasyslab.geospark.enums.IndexType;
-import org.datasyslab.geospark.enums.JoinBuildSide;
-import org.datasyslab.geospark.enums.JoinSparitionDominantSide;
+import org.locationtech.jts.geom.Envelope;
import java.io.Serializable;
import java.lang.reflect.Field;
-public class GeoSparkConf
+public class SedonaConf
implements Serializable
{
- // Global parameters of GeoSpark. All these parameters can be initialized through SparkConf.
+ // Global parameters of Sedona. All these parameters can be initialized through SparkConf.
private Boolean useIndex = false;
@@ -50,18 +53,18 @@ public class GeoSparkConf
private GridType joinGridType = GridType.QUADTREE;
- public GeoSparkConf(SparkConf sparkConf)
+ public SedonaConf(SparkConf sparkConf)
{
- this.useIndex = sparkConf.getBoolean("geospark.global.index", true);
- this.indexType = IndexType.getIndexType(sparkConf.get("geospark.global.indextype", "rtree"));
- this.joinApproximateTotalCount = sparkConf.getLong("geospark.join.approxcount", -1);
- String[] boundaryString = sparkConf.get("geospark.join.boundary", "0,0,0,0").split(",");
+ this.useIndex = sparkConf.getBoolean("sedona.global.index", true);
+ this.indexType = IndexType.getIndexType(sparkConf.get("sedona.global.indextype", "quadtree"));
+ this.joinApproximateTotalCount = sparkConf.getLong("sedona.join.approxcount", -1);
+ String[] boundaryString = sparkConf.get("sedona.join.boundary", "0,0,0,0").split(",");
this.datasetBoundary = new Envelope(Double.parseDouble(boundaryString[0]), Double.parseDouble(boundaryString[0]),
Double.parseDouble(boundaryString[0]), Double.parseDouble(boundaryString[0]));
- this.joinGridType = GridType.getGridType(sparkConf.get("geospark.join.gridtype", "quadtree"));
- this.joinBuildSide = JoinBuildSide.getBuildSide(sparkConf.get("geospark.join.indexbuildside", "left"));
- this.joinSparitionDominantSide = JoinSparitionDominantSide.getJoinSparitionDominantSide(sparkConf.get("geospark.join.spatitionside", "left"));
- this.fallbackPartitionNum = sparkConf.getInt("geospark.join.numpartition", -1);
+ this.joinGridType = GridType.getGridType(sparkConf.get("sedona.join.gridtype", "kdbtree"));
+ this.joinBuildSide = JoinBuildSide.getBuildSide(sparkConf.get("sedona.join.indexbuildside", "left"));
+ this.joinSparitionDominantSide = JoinSparitionDominantSide.getJoinSparitionDominantSide(sparkConf.get("sedona.join.spatitionside", "left"));
+ this.fallbackPartitionNum = sparkConf.getInt("sedona.join.numpartition", -1);
}
public Boolean getUseIndex()
@@ -149,7 +152,7 @@ public class GeoSparkConf
try {
String sb = "";
Class<?> objClass = this.getClass();
- sb += "GeoSpark Configuration:\n";
+ sb += "Sedona Configuration:\n";
Field[] fields = objClass.getDeclaredFields();
for (Field field : fields) {
String name = field.getName();
diff --git a/core/src/main/java/org/apache/sedona/core/utils/TimeUtils.java b/core/src/main/java/org/apache/sedona/core/utils/TimeUtils.java
new file mode 100644
index 0000000..ed8b93f
--- /dev/null
+++ b/core/src/main/java/org/apache/sedona/core/utils/TimeUtils.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.utils;
+
+public class TimeUtils
+{
+
+ public static long elapsedSince(long startTime)
+ {
+ return System.currentTimeMillis() - startTime;
+ }
+}
diff --git a/core/src/main/java/org/datasyslab/geospark/enums/GeometryType.java b/core/src/main/java/org/datasyslab/geospark/enums/GeometryType.java
deleted file mode 100755
index 16dce51..0000000
--- a/core/src/main/java/org/datasyslab/geospark/enums/GeometryType.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * FILE: GeometryType
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.datasyslab.geospark.enums;
-
-import java.io.Serializable;
-
-// TODO: Auto-generated Javadoc
-
-/**
- * The Enum GeometryType.
- */
-public enum GeometryType
- implements Serializable
-{
-
- POINT,
- POLYGON,
- LINESTRING,
- MULTIPOINT,
- MULTIPOLYGON,
- MULTILINESTRING,
- GEOMETRYCOLLECTION,
- CIRCLE,
- RECTANGLE;
-
- /**
- * Gets the GeometryType.
- *
- * @param str the str
- * @return the GeometryType
- */
- public static GeometryType getGeometryType(String str)
- {
- for (GeometryType me : GeometryType.values()) {
- if (me.name().equalsIgnoreCase(str)) { return me; }
- }
- throw new IllegalArgumentException("[" + GeometryType.class + "] Unsupported geometry type:" + str);
- }
-}
diff --git a/core/src/main/java/org/datasyslab/geospark/enums/GridType.java b/core/src/main/java/org/datasyslab/geospark/enums/GridType.java
deleted file mode 100755
index 468da44..0000000
--- a/core/src/main/java/org/datasyslab/geospark/enums/GridType.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * FILE: GridType
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.datasyslab.geospark.enums;
-
-import java.io.Serializable;
-
-// TODO: Auto-generated Javadoc
-
-/**
- * The Enum GridType.
- */
-public enum GridType
- implements Serializable
-{
-
- /**
- * The equalgrid.
- */
- EQUALGRID,
-
- /**
- * The hilbert.
- */
- HILBERT,
-
- /**
- * The rtree.
- */
- RTREE,
-
- /**
- * The voronoi.
- */
- VORONOI,
- /**
- * The voronoi.
- */
- QUADTREE,
-
- /**
- * K-D-B-tree (k-dimensional B-tree)
- */
- KDBTREE;
-
- /**
- * Gets the grid type.
- *
- * @param str the str
- * @return the grid type
- */
- public static GridType getGridType(String str)
- {
- for (GridType me : GridType.values()) {
- if (me.name().equalsIgnoreCase(str)) { return me; }
- }
- return null;
- }
-}
diff --git a/core/src/main/java/org/datasyslab/geospark/enums/IndexType.java b/core/src/main/java/org/datasyslab/geospark/enums/IndexType.java
deleted file mode 100755
index 40940df..0000000
--- a/core/src/main/java/org/datasyslab/geospark/enums/IndexType.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * FILE: IndexType
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.datasyslab.geospark.enums;
-
-import java.io.Serializable;
-
-// TODO: Auto-generated Javadoc
-
-/**
- * The Enum IndexType.
- */
-public enum IndexType
- implements Serializable
-{
-
- /**
- * The quadtree.
- */
- QUADTREE,
-
- /**
- * The rtree.
- */
- RTREE;
-
- /**
- * Gets the index type.
- *
- * @param str the str
- * @return the index type
- */
- public static IndexType getIndexType(String str)
- {
- for (IndexType me : IndexType.values()) {
- if (me.name().equalsIgnoreCase(str)) { return me; }
- }
- return null;
- }
-}
diff --git a/core/src/main/java/org/datasyslab/geospark/enums/JoinBuildSide.java b/core/src/main/java/org/datasyslab/geospark/enums/JoinBuildSide.java
deleted file mode 100644
index a464eab..0000000
--- a/core/src/main/java/org/datasyslab/geospark/enums/JoinBuildSide.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * FILE: JoinBuildSide
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.datasyslab.geospark.enums;
-
-import java.io.Serializable;
-
-/**
- * The enumerator type of JoinQuery JoinBuildSide. Each join query has two sides, left shape and right shape.
- * The join side desides which side the spatial index is built on. The other side will be streamed out.
- */
-public enum JoinBuildSide
- implements Serializable
-{
- LEFT,
- RIGHT;
-
- public static JoinBuildSide getBuildSide(String str)
- {
- for (JoinBuildSide me : JoinBuildSide.values()) {
- if (me.name().equalsIgnoreCase(str)) { return me; }
- }
- return null;
- }
-}
diff --git a/core/src/main/java/org/datasyslab/geospark/enums/JoinSparitionDominantSide.java b/core/src/main/java/org/datasyslab/geospark/enums/JoinSparitionDominantSide.java
deleted file mode 100644
index e181592..0000000
--- a/core/src/main/java/org/datasyslab/geospark/enums/JoinSparitionDominantSide.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * FILE: JoinSparitionDominantSide
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.datasyslab.geospark.enums;
-
-public enum JoinSparitionDominantSide
-{
- LEFT,
- RIGHT,
- NONE;
-
- public static JoinSparitionDominantSide getJoinSparitionDominantSide(String str)
- {
- for (JoinSparitionDominantSide me : JoinSparitionDominantSide.values()) {
- if (me.name().equalsIgnoreCase(str)) { return me; }
- }
- return null;
- }
-}
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/LineStringFormatMapper.java b/core/src/main/java/org/datasyslab/geospark/formatMapper/LineStringFormatMapper.java
deleted file mode 100644
index 4e5427b..0000000
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/LineStringFormatMapper.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * FILE: LineStringFormatMapper
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.datasyslab.geospark.formatMapper;
-
-import org.datasyslab.geospark.enums.FileDataSplitter;
-import org.datasyslab.geospark.enums.GeometryType;
-
-public class LineStringFormatMapper
- extends FormatMapper
-{
-
- /**
- * Instantiates a new line string format mapper.
- *
- * @param Splitter the splitter
- * @param carryInputData the carry input data
- */
- public LineStringFormatMapper(FileDataSplitter Splitter, boolean carryInputData)
- {
- super(0, -1, Splitter, carryInputData, GeometryType.LINESTRING);
- }
-
- /**
- * Instantiates a new line string format mapper.
- *
- * @param startOffset the start offset
- * @param endOffset the end offset
- * @param Splitter the splitter
- * @param carryInputData the carry input data
- */
- public LineStringFormatMapper(Integer startOffset, Integer endOffset, FileDataSplitter Splitter,
- boolean carryInputData)
- {
- super(startOffset, endOffset, Splitter, carryInputData, GeometryType.LINESTRING);
- }
-}
\ No newline at end of file
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/PointFormatMapper.java b/core/src/main/java/org/datasyslab/geospark/formatMapper/PointFormatMapper.java
deleted file mode 100644
index 389cb28..0000000
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/PointFormatMapper.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * FILE: PointFormatMapper
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.datasyslab.geospark.formatMapper;
-
-import org.datasyslab.geospark.enums.FileDataSplitter;
-import org.datasyslab.geospark.enums.GeometryType;
-
-public class PointFormatMapper
- extends FormatMapper
-{
-
- /**
- * Instantiates a new point format mapper.
- *
- * @param Splitter the splitter
- * @param carryInputData the carry input data
- */
- public PointFormatMapper(FileDataSplitter Splitter, boolean carryInputData)
- {
- super(0, 1, Splitter, carryInputData, GeometryType.POINT);
- }
-
- /**
- * Instantiates a new point format mapper.
- *
- * @param startOffset the start offset
- * @param Splitter the splitter
- * @param carryInputData the carry input data
- */
- public PointFormatMapper(Integer startOffset, FileDataSplitter Splitter,
- boolean carryInputData)
- {
- super(startOffset, startOffset+1, Splitter, carryInputData, GeometryType.POINT);
- }
-
-}
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/PolygonFormatMapper.java b/core/src/main/java/org/datasyslab/geospark/formatMapper/PolygonFormatMapper.java
deleted file mode 100644
index 84612da..0000000
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/PolygonFormatMapper.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * FILE: PolygonFormatMapper
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.datasyslab.geospark.formatMapper;
-
-import org.datasyslab.geospark.enums.FileDataSplitter;
-import org.datasyslab.geospark.enums.GeometryType;
-
-public class PolygonFormatMapper
- extends FormatMapper
-{
-
- /**
- * Instantiates a new polygon format mapper.
- *
- * @param Splitter the splitter
- * @param carryInputData the carry input data
- */
- public PolygonFormatMapper(FileDataSplitter Splitter, boolean carryInputData)
- {
- super(0, -1, Splitter, carryInputData, GeometryType.POLYGON);
- }
-
- /**
- * Instantiates a new polygon format mapper.
- *
- * @param startOffset the start offset
- * @param endOffset the end offset
- * @param Splitter the splitter
- * @param carryInputData the carry input data
- */
- public PolygonFormatMapper(Integer startOffset, Integer endOffset, FileDataSplitter Splitter,
- boolean carryInputData)
- {
- super(startOffset, endOffset, Splitter, carryInputData, GeometryType.POLYGON);
- }
-}
\ No newline at end of file
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/RddReader.java b/core/src/main/java/org/datasyslab/geospark/formatMapper/RddReader.java
deleted file mode 100644
index f99ad55..0000000
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/RddReader.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * FILE: RddReader
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.datasyslab.geospark.formatMapper;
-
-import org.locationtech.jts.geom.Geometry;
-import org.apache.spark.api.java.JavaRDD;
-import org.datasyslab.geospark.spatialRDD.SpatialRDD;
-
-class RddReader
-{
- public static SpatialRDD<Geometry> createSpatialRDD(JavaRDD rawTextRDD, FormatMapper<Geometry> formatMapper)
- {
- SpatialRDD spatialRDD = new SpatialRDD<Geometry>();
- spatialRDD.rawSpatialRDD = rawTextRDD.mapPartitions(formatMapper);
- spatialRDD.fieldNames = formatMapper.readPropertyNames(rawTextRDD.take(1).get(0).toString());
- return spatialRDD;
- }
-}
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/RectangleFormatMapper.java b/core/src/main/java/org/datasyslab/geospark/formatMapper/RectangleFormatMapper.java
deleted file mode 100644
index f489d61..0000000
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/RectangleFormatMapper.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * FILE: RectangleFormatMapper
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.datasyslab.geospark.formatMapper;
-
-import org.datasyslab.geospark.enums.FileDataSplitter;
-import org.datasyslab.geospark.enums.GeometryType;
-
-public class RectangleFormatMapper
- extends FormatMapper
-{
-
- /**
- * Instantiates a new rectangle format mapper.
- *
- * @param Splitter the splitter
- * @param carryInputData the carry input data
- */
- public RectangleFormatMapper(FileDataSplitter Splitter, boolean carryInputData)
- {
- super(0, 3, Splitter, carryInputData, GeometryType.RECTANGLE);
- }
-
- /**
- * Instantiates a new rectangle format mapper.
- *
- * @param startOffset the start offset
- * @param Splitter the splitter
- * @param carryInputData the carry input data
- */
- public RectangleFormatMapper(Integer startOffset, FileDataSplitter Splitter,
- boolean carryInputData)
- {
- super(startOffset, startOffset+3, Splitter, carryInputData, GeometryType.RECTANGLE);
- }
-}
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/ShapeFileConst.java b/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/ShapeFileConst.java
deleted file mode 100644
index b3882d5..0000000
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/ShapeFileConst.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * FILE: ShapeFileConst
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp;
-
-// TODO: Auto-generated Javadoc
-
-/**
- * The Interface ShapeFileConst.
- */
-public interface ShapeFileConst
-{
-
- /**
- * Consts for .shp file
- */
- public static final int EXPECT_FILE_CODE = 9994;
-
- /**
- * The Constant EXPECT_FILE_VERSION.
- */
- public static final int EXPECT_FILE_VERSION = 1000;
-
- /**
- * The Constant HEAD_FILE_LENGTH_16BIT.
- */
- public static final int HEAD_FILE_LENGTH_16BIT = 50;
-
- /**
- * The Constant HEAD_EMPTY_NUM.
- */
- public static final int HEAD_EMPTY_NUM = 5;
-
- /**
- * The Constant HEAD_BOX_NUM.
- */
- public static final int HEAD_BOX_NUM = 8;
-
- /**
- * The Constant INT_LENGTH.
- */
- public static final int INT_LENGTH = 4;
-
- /**
- * The Constant DOUBLE_LENGTH.
- */
- public static final int DOUBLE_LENGTH = 8;
-
- /**
- * Consts for .dbf file
- */
- public static final byte FIELD_DESCRIPTOR_TERMINATOR = 0x0d;
-
- /**
- * The Constant FIELD_NAME_LENGTH.
- */
- public static final byte FIELD_NAME_LENGTH = 11;
-
- /**
- * The Constant RECORD_DELETE_FLAG.
- */
- public static final byte RECORD_DELETE_FLAG = 0x2A;
-
- /**
- * The Constant FILE_END_FLAG.
- */
- public static final byte FILE_END_FLAG = 0x1A;
-
- /**
- * The Constant RECORD_EXIST_FLAG.
- */
- public static final byte RECORD_EXIST_FLAG = 0x20;
-}
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/ShapeReader.java b/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/ShapeReader.java
deleted file mode 100644
index 0594f82..0000000
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/ShapeReader.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * FILE: ShapeReader
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp;
-
-public interface ShapeReader
-{
-
- int readInt();
-
- double readDouble();
-
- byte readByte();
-
- void skip(int numBytes);
-}
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/TypeUnknownException.java b/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/TypeUnknownException.java
deleted file mode 100644
index f416059..0000000
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/parseUtils/shp/TypeUnknownException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * FILE: TypeUnknownException
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp;
-
-// TODO: Auto-generated Javadoc
-
-/**
- * The Class TypeUnknownException.
- */
-public class TypeUnknownException
- extends RuntimeException
-{
-
- /**
- * create an exception indicates that the shape type number we get from .shp file is valid
- *
- * @param typeID the type ID
- */
- public TypeUnknownException(int typeID)
- {
- super("Unknown shape type " + typeID);
- }
-}
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/shapes/ShapeKey.java b/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/shapes/ShapeKey.java
deleted file mode 100644
index 8d4c0f3..0000000
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/shapes/ShapeKey.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * FILE: ShapeKey
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.datasyslab.geospark.formatMapper.shapefileParser.shapes;
-
-import java.io.DataOutput;
-import java.io.IOException;
-import java.io.Serializable;
-
-public class ShapeKey
- implements Serializable
-{
-
- /**
- * record id
- */
- Long index = 0l;
-
- public void write(DataOutput dataOutput)
- throws IOException
- {
- dataOutput.writeLong(index);
- }
-
- public long getIndex()
- {
- return index;
- }
-
- public void setIndex(long _index)
- {
- index = _index;
- }
-}
diff --git a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/shapes/ShpRecord.java b/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/shapes/ShpRecord.java
deleted file mode 100644
index 734c0df..0000000
--- a/core/src/main/java/org/datasyslab/geospark/formatMapper/shapefileParser/shapes/ShpRecord.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * FILE: ShpRecord
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.datasyslab.geospark.formatMapper.shapefileParser.shapes;
-
-import org.apache.hadoop.io.BytesWritable;
-
-import java.io.Serializable;
-
-public class ShpRecord
- implements Serializable
-{
-
- /**
- * primitive byte contents
- */
- private BytesWritable bytes = null;
-
- /**
- * shape type
- */
- private int typeID = -1;
-
- /**
- * create a ShpRecord with primitive bytes and shape type id we abstract from .shp file
- *
- * @param byteArray
- * @param shapeTypeID
- */
- public ShpRecord(byte[] byteArray, int shapeTypeID)
- {
- bytes = new BytesWritable();
- bytes.set(byteArray, 0, byteArray.length);
- typeID = shapeTypeID;
- }
-
- public BytesWritable getBytes()
- {
- return bytes;
- }
-
- public int getTypeID()
- {
- return typeID;
- }
-}
diff --git a/core/src/main/java/org/datasyslab/geospark/joinJudgement/DedupParams.java b/core/src/main/java/org/datasyslab/geospark/joinJudgement/DedupParams.java
deleted file mode 100644
index fed0907..0000000
--- a/core/src/main/java/org/datasyslab/geospark/joinJudgement/DedupParams.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * FILE: DedupParams
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.datasyslab.geospark.joinJudgement;
-
-import org.locationtech.jts.geom.Envelope;
-
-import java.io.Serializable;
-import java.util.List;
-import java.util.Objects;
-
-/**
- * Contains information necessary to activate de-dup logic in sub-classes of {@link JudgementBase}.
- */
-public final class DedupParams
- implements Serializable
-{
- private final List<Envelope> partitionExtents;
-
- /**
- * @param partitionExtents A list of partition extents in such an order that
- * an index of an element in this list matches partition ID.
- */
- public DedupParams(List<Envelope> partitionExtents)
- {
- this.partitionExtents = Objects.requireNonNull(partitionExtents, "partitionExtents");
- }
-
- public List<Envelope> getPartitionExtents()
- {
- return partitionExtents;
- }
-}
diff --git a/core/src/main/java/org/datasyslab/geospark/rangeJudgement/RangeFilter.java b/core/src/main/java/org/datasyslab/geospark/rangeJudgement/RangeFilter.java
deleted file mode 100644
index 007fbe8..0000000
--- a/core/src/main/java/org/datasyslab/geospark/rangeJudgement/RangeFilter.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * FILE: RangeFilter
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.datasyslab.geospark.rangeJudgement;
-
-import org.locationtech.jts.geom.Geometry;
-import org.apache.spark.api.java.function.Function;
-
-// TODO: Auto-generated Javadoc
-
-public class RangeFilter<U extends Geometry, T extends Geometry>
- extends JudgementBase
- implements Function<T, Boolean>
-{
-
- public RangeFilter(U queryWindow, boolean considerBoundaryIntersection, boolean leftCoveredByRight)
- {
- super(queryWindow, considerBoundaryIntersection, leftCoveredByRight);
- }
-
- /* (non-Javadoc)
- * @see org.apache.spark.api.java.function.Function#call(java.lang.Object)
- */
- public Boolean call(T geometry)
- throws Exception
- {
- if (leftCoveredByRight) {
- return match(geometry, queryGeometry);
- }
- else {
- return match(queryGeometry, queryGeometry);
- }
- }
-}
diff --git a/core/src/main/java/org/datasyslab/geospark/spatialPartitioning/quadtree/QuadNode.java b/core/src/main/java/org/datasyslab/geospark/spatialPartitioning/quadtree/QuadNode.java
deleted file mode 100644
index 46de5f7..0000000
--- a/core/src/main/java/org/datasyslab/geospark/spatialPartitioning/quadtree/QuadNode.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * FILE: QuadNode
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.datasyslab.geospark.spatialPartitioning.quadtree;
-
-import java.io.Serializable;
-
-public class QuadNode<T>
- implements Serializable
-{
- QuadRectangle r;
- T element;
-
- QuadNode(QuadRectangle r, T element)
- {
- this.r = r;
- this.element = element;
- }
-
- @Override
- public String toString()
- {
- return r.toString();
- }
-}
diff --git a/core/src/main/java/org/datasyslab/geospark/utils/HalfOpenRectangle.java b/core/src/main/java/org/datasyslab/geospark/utils/HalfOpenRectangle.java
deleted file mode 100644
index f7403a4..0000000
--- a/core/src/main/java/org/datasyslab/geospark/utils/HalfOpenRectangle.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * FILE: HalfOpenRectangle
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.datasyslab.geospark.utils;
-
-import org.locationtech.jts.geom.Envelope;
-import org.locationtech.jts.geom.Point;
-
-public class HalfOpenRectangle
-{
- private final Envelope envelope;
-
- public HalfOpenRectangle(Envelope envelope)
- {
- this.envelope = envelope;
- }
-
- public boolean contains(Point point)
- {
- return contains(point.getX(), point.getY());
- }
-
- public boolean contains(double x, double y)
- {
- return x >= envelope.getMinX() && x < envelope.getMaxX()
- && y >= envelope.getMinY() && y < envelope.getMaxY();
- }
-
- public Envelope getEnvelope()
- {
- return envelope;
- }
-}
diff --git a/core/src/main/java/org/datasyslab/geospark/utils/TimeUtils.java b/core/src/main/java/org/datasyslab/geospark/utils/TimeUtils.java
deleted file mode 100644
index 8d91349..0000000
--- a/core/src/main/java/org/datasyslab/geospark/utils/TimeUtils.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * FILE: TimeUtils
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.datasyslab.geospark.utils;
-
-public class TimeUtils
-{
-
- public static long elapsedSince(long startTime)
- {
- return System.currentTimeMillis() - startTime;
- }
-}
diff --git a/core/src/main/scala/org/datasyslab/geospark/monitoring/GeoSparkListener.scala b/core/src/main/scala/org/apache/sedona/core/monitoring/Listener.scala
similarity index 73%
rename from core/src/main/scala/org/datasyslab/geospark/monitoring/GeoSparkListener.scala
rename to core/src/main/scala/org/apache/sedona/core/monitoring/Listener.scala
index f35b5d2..ba97c96 100644
--- a/core/src/main/scala/org/datasyslab/geospark/monitoring/GeoSparkListener.scala
+++ b/core/src/main/scala/org/apache/sedona/core/monitoring/Listener.scala
@@ -1,27 +1,29 @@
/*
- * FILE: GeoSparkListener.scala
- * Copyright (c) 2015 - 2019 GeoSpark Development Team
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.datasyslab.geospark.monitoring
+package org.apache.sedona.core.monitoring
import org.apache.spark.scheduler.{SparkListener, SparkListenerStageCompleted, SparkListenerTaskEnd}
import scala.collection.mutable
-class GeoSparkListener extends SparkListener {
+class Listener extends SparkListener {
private val counterNames = Seq("buildCount", "streamCount", "candidateCount", "resultCount")
@@ -42,7 +44,7 @@ class GeoSparkListener extends SparkListener {
val accumulables = stageCompleted.stageInfo.accumulables
def getCounterOption(name: String) = {
- accumulables.find { case (k, v) => v.name == Some("geospark.spatialjoin." + name) }
+ accumulables.find { case (k, v) => v.name == Some("sedona.spatialjoin." + name) }
}
def getCounter(name: String) = {
diff --git a/core/src/main/scala/org/apache/sedona/core/monitoring/Metric.scala b/core/src/main/scala/org/apache/sedona/core/monitoring/Metric.scala
new file mode 100644
index 0000000..373073a
--- /dev/null
+++ b/core/src/main/scala/org/apache/sedona/core/monitoring/Metric.scala
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.monitoring
+
+import org.apache.spark.TaskContext
+import org.apache.spark.util.AccumulatorV2
+
+import scala.collection.mutable
+
+/**
+ * An accumulator to collect custom per-task metrics into a map
+ * keyed by partition ID processed by the task.
+ */
+case class Metric(initialValue: Map[Int, Long] = Map()) extends AccumulatorV2[Long, Map[Int, Long]] {
+ private var _counts: mutable.Map[Int, Long] = mutable.Map[Int, Long]() ++ initialValue
+
+ override def isZero: Boolean = _counts.isEmpty
+
+ override def copy(): AccumulatorV2[Long, Map[Int, Long]] = new Metric(_counts.toMap)
+
+ override def reset(): Unit = _counts.clear()
+
+ override def add(v: Long): Unit = add(TaskContext.getPartitionId, v)
+
+ private def add(partitionId: Int, value: Long) = {
+ _counts(partitionId) = value + _counts.getOrElse(partitionId, 0L)
+ }
+
+ override def merge(other: AccumulatorV2[Long, Map[Int, Long]]): Unit = {
+ other.asInstanceOf[Metric]._counts.foreach {
+ case (partitionId, value) => add(partitionId, value)
+ }
+ }
+
+ override def value: Map[Int, Long] = _counts.toMap
+}
diff --git a/core/src/main/scala/org/apache/sedona/core/monitoring/Metrics.scala b/core/src/main/scala/org/apache/sedona/core/monitoring/Metrics.scala
new file mode 100644
index 0000000..b4359f2
--- /dev/null
+++ b/core/src/main/scala/org/apache/sedona/core/monitoring/Metrics.scala
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.monitoring
+
+import org.apache.spark.SparkContext
+
+object Metrics {
+ def createMetric(sc: SparkContext, name: String): Metric = {
+ val acc = new Metric()
+ sc.register(acc, "sedona.spatialjoin." + name)
+ acc
+ }
+}
diff --git a/core/src/main/scala/org/apache/sedona/core/python/SerializationException.scala b/core/src/main/scala/org/apache/sedona/core/python/SerializationException.scala
new file mode 100644
index 0000000..d3bd03c
--- /dev/null
+++ b/core/src/main/scala/org/apache/sedona/core/python/SerializationException.scala
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.python
+
+final case class SerializationException(private val message: String = "",
+ private val cause: Throwable = None.orNull)
+ extends Exception(message, cause)
diff --git a/core/src/main/scala/org/apache/sedona/core/python/adapters/EnvelopeAdapter.scala b/core/src/main/scala/org/apache/sedona/core/python/adapters/EnvelopeAdapter.scala
new file mode 100644
index 0000000..8304948
--- /dev/null
+++ b/core/src/main/scala/org/apache/sedona/core/python/adapters/EnvelopeAdapter.scala
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.python.adapters
+
+import net.razorvine.pickle.Unpickler
+import net.razorvine.pickle.objects.ClassDict
+import org.locationtech.jts.geom.Envelope
+
+import scala.collection.JavaConverters._
+
+object EnvelopeAdapter {
+ def getFromPython(bytes: Array[Byte]): java.util.List[Envelope] = {
+ val arrBytes = bytes.map(x => x.toByte)
+ val unpickler = new Unpickler
+ val pythonEnvelopes = unpickler.loads(arrBytes).asInstanceOf[java.util.ArrayList[_]].toArray
+ pythonEnvelopes.map(pythonEnvelope => new Envelope(
+ pythonEnvelope.asInstanceOf[ClassDict].get("minx").asInstanceOf[Double],
+ pythonEnvelope.asInstanceOf[ClassDict].get("maxx").asInstanceOf[Double],
+ pythonEnvelope.asInstanceOf[ClassDict].get("miny").asInstanceOf[Double],
+ pythonEnvelope.asInstanceOf[ClassDict].get("maxy").asInstanceOf[Double]
+ )).toList.asJava
+ }
+}
diff --git a/core/src/main/scala/org/apache/sedona/core/python/adapters/GeomSerializer.scala b/core/src/main/scala/org/apache/sedona/core/python/adapters/GeomSerializer.scala
new file mode 100644
index 0000000..f7eff1d
--- /dev/null
+++ b/core/src/main/scala/org/apache/sedona/core/python/adapters/GeomSerializer.scala
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.python.adapters
+
+import org.apache.sedona.core.python.translation.PythonGeometrySerializer
+
+trait GeomSerializer {
+ val geometrySerializer = new PythonGeometrySerializer()
+}
diff --git a/core/src/main/scala/org/apache/sedona/core/python/adapters/GeometryAdapter.scala b/core/src/main/scala/org/apache/sedona/core/python/adapters/GeometryAdapter.scala
new file mode 100644
index 0000000..dd8199e
--- /dev/null
+++ b/core/src/main/scala/org/apache/sedona/core/python/adapters/GeometryAdapter.scala
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.python.adapters
+
+import org.locationtech.jts.geom.Geometry
+
+object GeometryAdapter extends GeomSerializer {
+
+ def translateToJava(geometryBytes: java.util.ArrayList[Int]): Geometry = {
+ val bytesData = geometryBytes.toArray.map(x => x.asInstanceOf[Int].toByte)
+ geometrySerializer.deserialize(bytesData)
+ }
+}
diff --git a/core/src/main/scala/org/apache/sedona/core/python/adapters/JoinParamsAdapter.scala b/core/src/main/scala/org/apache/sedona/core/python/adapters/JoinParamsAdapter.scala
new file mode 100644
index 0000000..4e13e94
--- /dev/null
+++ b/core/src/main/scala/org/apache/sedona/core/python/adapters/JoinParamsAdapter.scala
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.python.adapters
+
+import org.apache.sedona.core.enums.{IndexType, JoinBuildSide}
+import org.apache.sedona.core.spatialOperator.JoinQuery.JoinParams
+
+object JoinParamsAdapter {
+ def createJoinParams(useIndex: Boolean = false, indexType: String, joinBuildSide: String): JoinParams = {
+ val buildSide = JoinBuildSide.getBuildSide(joinBuildSide)
+ val currIndexType = IndexType.getIndexType(indexType)
+ new JoinParams(useIndex, currIndexType, buildSide)
+ }
+}
\ No newline at end of file
diff --git a/core/src/main/scala/org/datasyslab/geospark/python/adapters/GeoSparkPythonConverter.scala b/core/src/main/scala/org/apache/sedona/core/python/adapters/PythonConverter.scala
similarity index 52%
rename from core/src/main/scala/org/datasyslab/geospark/python/adapters/GeoSparkPythonConverter.scala
rename to core/src/main/scala/org/apache/sedona/core/python/adapters/PythonConverter.scala
index 31d9723..dd31c79 100644
--- a/core/src/main/scala/org/datasyslab/geospark/python/adapters/GeoSparkPythonConverter.scala
+++ b/core/src/main/scala/org/apache/sedona/core/python/adapters/PythonConverter.scala
@@ -1,12 +1,31 @@
-package org.datasyslab.geospark.python.adapters
-
-import org.locationtech.jts.geom.Geometry
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.python.adapters
+
+import org.apache.sedona.core.python.translation._
import org.apache.spark.api.java.{JavaPairRDD, JavaRDD}
-import org.datasyslab.geospark.python.translation.{FlatPairRddConverter, GeometryRddConverter, GeometrySeqToPythonConverter, HashSetPairRddConverter, PythonGeometrySerializer, PythonRDDToJavaConverter}
+import org.locationtech.jts.geom.Geometry
import scala.collection.convert.Wrappers.SeqWrapper
-object GeoSparkPythonConverter extends GeomSerializer{
+object PythonConverter extends GeomSerializer {
def translateSpatialRDDToPython(spatialRDD: JavaRDD[Geometry]): JavaRDD[Array[Byte]] =
GeometryRddConverter(spatialRDD, geometrySerializer).translateToPython
diff --git a/core/src/main/scala/org/datasyslab/geospark/python/adapters/PythonRddToJavaRDDAdapter.scala b/core/src/main/scala/org/apache/sedona/core/python/adapters/PythonRddToJavaRDDAdapter.scala
similarity index 61%
rename from core/src/main/scala/org/datasyslab/geospark/python/adapters/PythonRddToJavaRDDAdapter.scala
rename to core/src/main/scala/org/apache/sedona/core/python/adapters/PythonRddToJavaRDDAdapter.scala
index de04c75..f6196d7 100644
--- a/core/src/main/scala/org/datasyslab/geospark/python/adapters/PythonRddToJavaRDDAdapter.scala
+++ b/core/src/main/scala/org/apache/sedona/core/python/adapters/PythonRddToJavaRDDAdapter.scala
@@ -1,24 +1,35 @@
-package org.datasyslab.geospark.python.adapters
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.python.adapters
-import org.locationtech.jts.geom.{Geometry, LineString, Point, Polygon}
import net.razorvine.pickle.Unpickler
import net.razorvine.pickle.objects.ClassDict
import org.apache.spark.api.java.JavaRDD
+import org.locationtech.jts.geom.{Geometry, LineString, Point, Polygon}
-object PythonRddToJavaRDDAdapter extends GeomSerializer{
+object PythonRddToJavaRDDAdapter extends GeomSerializer {
def deserializeToPointRawRDD(javaRDD: JavaRDD[Array[Byte]]): JavaRDD[Point] = {
translateToJava(javaRDD).asInstanceOf[JavaRDD[Point]]
}
- def deserializeToPolygonRawRDD(javaRDD: JavaRDD[Array[Byte]]): JavaRDD[Polygon] = {
- translateToJava(javaRDD).asInstanceOf[JavaRDD[Polygon]]
- }
-
- def deserializeToLineStringRawRDD(javaRDD: JavaRDD[Array[Byte]]): JavaRDD[LineString] = {
- translateToJava(javaRDD).asInstanceOf[JavaRDD[LineString]]
- }
-
private def translateToJava(pythonRDD: JavaRDD[Array[Byte]]): JavaRDD[Geometry] = {
JavaRDD.fromRDD(pythonRDD.rdd.mapPartitions { iter =>
iter.flatMap { row =>
@@ -39,4 +50,12 @@ object PythonRddToJavaRDDAdapter extends GeomSerializer{
}
}.toJavaRDD())
}
+
+ def deserializeToPolygonRawRDD(javaRDD: JavaRDD[Array[Byte]]): JavaRDD[Polygon] = {
+ translateToJava(javaRDD).asInstanceOf[JavaRDD[Polygon]]
+ }
+
+ def deserializeToLineStringRawRDD(javaRDD: JavaRDD[Array[Byte]]): JavaRDD[LineString] = {
+ translateToJava(javaRDD).asInstanceOf[JavaRDD[LineString]]
+ }
}
diff --git a/core/src/main/scala/org/apache/sedona/core/python/adapters/RawJvmIndexRDDAdapter.scala b/core/src/main/scala/org/apache/sedona/core/python/adapters/RawJvmIndexRDDAdapter.scala
new file mode 100644
index 0000000..ab254ed
--- /dev/null
+++ b/core/src/main/scala/org/apache/sedona/core/python/adapters/RawJvmIndexRDDAdapter.scala
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.python.adapters
+
+import org.apache.sedona.core.spatialRDD.SpatialRDD
+import org.apache.spark.api.java.JavaRDD
+import org.locationtech.jts.geom.Geometry
+import org.locationtech.jts.index.SpatialIndex
+
+
+object RawJvmIndexRDDAdapter {
+ def setRawIndexRDD(spatialRDD: SpatialRDD[Geometry], indexRDD: JavaRDD[SpatialIndex]): Boolean = {
+ spatialRDD.indexedRawRDD = indexRDD
+ true
+ }
+}
diff --git a/core/src/main/scala/org/apache/sedona/core/python/adapters/SpatialObjectLoaderAdapter.scala b/core/src/main/scala/org/apache/sedona/core/python/adapters/SpatialObjectLoaderAdapter.scala
new file mode 100644
index 0000000..746b9f5
--- /dev/null
+++ b/core/src/main/scala/org/apache/sedona/core/python/adapters/SpatialObjectLoaderAdapter.scala
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.python.adapters
+
+import org.apache.sedona.core.spatialRDD.{LineStringRDD, PointRDD, PolygonRDD, SpatialRDD}
+import org.apache.spark.api.java.{JavaRDD, JavaSparkContext}
+import org.locationtech.jts.geom.{Geometry, LineString, Point, Polygon}
+import org.locationtech.jts.index.SpatialIndex
+
+
+object SpatialObjectLoaderAdapter {
+ def loadPointSpatialRDD(sc: JavaSparkContext, path: String): PointRDD = {
+ new PointRDD(sc.objectFile[Point](path))
+ }
+
+ def loadPolygonSpatialRDD(sc: JavaSparkContext, path: String): PolygonRDD = {
+ new PolygonRDD(sc.objectFile[Polygon](path))
+ }
+
+ def loadSpatialRDD(sc: JavaSparkContext, path: String): SpatialRDD[Geometry] = {
+ val spatialRDD = new SpatialRDD[Geometry]
+ spatialRDD.rawSpatialRDD = sc.objectFile[Geometry](path)
+ spatialRDD
+ }
+
+ def loadLineStringSpatialRDD(sc: JavaSparkContext, path: String): LineStringRDD = {
+ new LineStringRDD(sc.objectFile[LineString](path))
+ }
+
+ def loadIndexRDD(sc: JavaSparkContext, path: String): JavaRDD[SpatialIndex] = {
+ sc.objectFile[SpatialIndex](path)
+ }
+}
diff --git a/core/src/main/scala/org/apache/sedona/core/python/translation/CircleSerializer.scala b/core/src/main/scala/org/apache/sedona/core/python/translation/CircleSerializer.scala
new file mode 100644
index 0000000..f91267f
--- /dev/null
+++ b/core/src/main/scala/org/apache/sedona/core/python/translation/CircleSerializer.scala
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.sedona.core.python.translation
+
+import org.apache.sedona.core.geometryObjects.Circle
+import org.apache.sedona.core.python.utils.implicits._
+import org.locationtech.jts.io.WKBWriter
+
+
+case class CircleSerializer(geometry: Circle) {
+ private val isCircle = Array(1.toByte)
+
+ def serialize: Array[Byte] = {
+ val wkbWriter = new WKBWriter(2, 2)
+ val serializedGeom = wkbWriter.write(geometry.getCenterGeometry)
+ val userDataBinary = geometry.userDataToUtf8ByteArray
+ val userDataLengthArray = userDataBinary.length.toByteArray()
+ val serializedGeomLength = serializedGeom.length.toByteArray()
+ val radius = geometry.getRadius.toDouble
+ isCircle ++ serializedGeomLength ++ userDataLengthArray ++ serializedGeom ++ userDataBinary ++ radius.toByteArray()
+ }
+
+}
diff --git a/core/src/main/scala/org/apache/sedona/core/python/translation/FlatPairRddConverter.scala b/core/src/main/scala/org/apache/sedona/core/python/translation/FlatPairRddConverter.scala
new file mode 100644
index 0000000..6682722
--- /dev/null
+++ b/core/src/main/scala/org/apache/sedona/core/python/translation/FlatPairRddConverter.scala
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
... 30746 lines suppressed ...