From 1c8d0dc5ac63c699af914275654ef84b960fe350 Mon Sep 17 00:00:00 2001 From: Eugene Cheipesh Date: Fri, 26 Nov 2021 13:19:06 -0500 Subject: [PATCH] Move geowave and geomesa projects out --- CHANGELOG.md | 1 + README.md | 2 - build.sbt | 11 - docs/guide/module-hierarchy.rst | 21 -- docs/guide/vector-backends.rst | 82 ----- docs/index.rst | 1 - geomesa/src/main/resources/reference.conf | 15 - ...FeatureToGeoMesaSimpleFeatureMethods.scala | 34 -- .../geomesa/geotools/GeoMesaImplicits.scala | 29 -- .../GeometryToGeoMesaSimpleFeature.scala | 88 ----- .../geotrellis/geomesa/geotools/package.scala | 19 -- .../store/geomesa/GeoMesaFeatureReader.scala | 83 ----- .../store/geomesa/GeoMesaFeatureWriter.scala | 77 ----- .../spark/store/geomesa/GeoMesaInstance.scala | 56 ---- .../store/geomesa/conf/GeoMesaConfig.scala | 26 -- .../spark/store/geomesa/package.scala | 29 -- .../geotools/GeoMesaSimpleFeatureType.scala | 63 ---- .../geomesa/GeoMesaPersistenceSpec.scala | 137 -------- geowave/Makefile | 2 - geowave/README.md | 55 ---- geowave/benchmark/README.md | 99 ------ .../src/main/resources/application.conf | 12 - .../benchmark/src/main/resources/logback.xml | 31 -- .../geowave/BenchmarkEnvironment.scala | 30 -- .../geowave/IngestBenchmarkData.scala | 66 ---- .../geotrellis/geowave/QueryBenchmark.scala | 240 -------------- geowave/docker-compose.override.yml | 9 - geowave/docker-compose.yml | 13 - geowave/docs/README.md | 173 ---------- geowave/docs/schemas/delete-message.md | 203 ------------ geowave/docs/schemas/index-message.md | 116 ------- geowave/docs/schemas/ingest-message.md | 149 --------- ...wave.adapter.GeoTrellisDataAdapterProvider | 1 - ...s.geowave.adapter.HandlersRegistryProvider | 1 - ....core.index.persist.PersistableRegistrySpi | 1 - ...re.store.spi.DimensionalityTypeProviderSpi | 1 - .../resources/json/delete-message.schema.json | 108 ------- .../resources/json/index-message.schema.json | 82 ----- .../resources/json/ingest-message.schema.json | 61 ---- .../main/resources/json/message.schema.json | 41 --- geowave/src/main/resources/reference.conf | 12 - .../GeoTrellisPersistableRegistry.scala | 60 ---- .../scala/geotrellis/geowave/Implicits.scala | 94 ------ .../geowave/adapter/AvroFieldReader.scala | 25 -- .../geowave/adapter/AvroFieldWriter.scala | 28 -- .../geowave/adapter/DataTypeRegistry.scala | 35 -- .../adapter/ElevationFieldHandler.scala | 24 -- .../adapter/GeoTrellisDataAdapter.scala | 221 ------------- .../GeoTrellisDataAdapterProvider.scala | 24 -- .../adapter/GeometryFieldHandler.scala | 24 -- .../geowave/adapter/IndexFieldHandler.scala | 45 --- .../adapter/TimestampFieldHandler.scala | 24 -- .../adapter/geotiff/GeoTiffAdapter.scala | 91 ------ .../geotiff/GeoTiffAdapterProvider.scala | 25 -- .../adapter/geotiff/GeoTiffFieldReader.scala | 26 -- .../adapter/geotiff/GeoTiffFieldWriter.scala | 26 -- .../geowave/adapter/geotiff/package.scala | 23 -- .../geotrellis/geowave/adapter/package.scala | 48 --- .../raster/MulitbandRasterAdapter.scala | 57 ---- .../raster/MultibandRasterReader.scala | 27 -- .../raster/MultibandRasterWriter.scala | 27 -- .../adapter/raster/avro/Implicits.scala | 21 -- .../adapter/raster/avro/RasterCodec.scala | 47 --- .../geowave/adapter/raster/avro/package.scala | 19 -- .../geowave/api/SQueryBuilder.scala | 23 -- .../geotrellis/geowave/api/package.scala | 27 -- .../geotrellis/geowave/conf/Implicits.scala | 27 -- .../geowave/conf/StoreConfiguration.scala | 42 --- .../geotrellis/geowave/conf/package.scala | 19 -- .../geowave/dsl/DataAdapterParameters.scala | 51 --- .../geowave/dsl/DataTypeReader.scala | 33 -- .../geowave/dsl/DeleteParameters.scala | 76 ----- .../geowave/dsl/IndexParameters.scala | 92 ------ .../geowave/dsl/IngestParameters.scala | 50 --- .../geotrellis/geowave/dsl/Metadata.scala | 30 -- .../geowave/dsl/QueryConfiguration.scala | 44 --- .../geotrellis/geowave/dsl/TilingBounds.scala | 28 -- .../geotrellis/geowave/dsl/VoxelBounds.scala | 28 -- .../geowave/dsl/VoxelBounds2D.scala | 59 ---- .../geowave/dsl/VoxelBounds3D.scala | 67 ---- .../geowave/dsl/VoxelBounds4D.scala | 76 ----- .../geowave/dsl/VoxelDimensions.scala | 49 --- .../geowave/dsl/avro/GeometryCodecs.scala | 101 ------ .../geowave/dsl/avro/Implicits.scala | 21 -- .../geowave/dsl/avro/VoxelBoundsCodec.scala | 120 ------- .../dsl/avro/VoxelDimensionsCodec.scala | 93 ------ .../geotrellis/geowave/dsl/avro/package.scala | 19 -- .../geowave/dsl/json/Implicits.scala | 88 ----- .../geowave/dsl/json/JsonValidator.scala | 58 ---- .../dsl/json/JsonValidatorErrors.scala | 33 -- .../geotrellis/geowave/dsl/json/package.scala | 19 -- .../geotrellis/geowave/dsl/package.scala | 61 ---- .../geowave/dsl/syntax/Implicits.scala | 32 -- .../geowave/dsl/syntax/package.scala | 19 -- ...SpatialTemporalElevationIndexBuilder.scala | 27 -- ...alTemporalElevationIndexTypeProvider.scala | 129 -------- .../SpatialTemporalElevationOptions.scala | 77 ----- .../geowave/index/dimension/Elevation.scala | 89 ----- .../index/dimension/ElevationDefinition.scala | 25 -- .../index/dimension/ElevationReader.scala | 23 -- .../index/dimension/ElevationWriter.scala | 23 -- .../geowave/index/field/ElevationField.scala | 116 ------- .../query/ExplicitSpatialElevationQuery.scala | 44 --- ...xplicitSpatialTemporalElevationQuery.scala | 53 --- .../geowave/ingest/ConfigureIndex.scala | 49 --- .../geowave/ingest/ExecuteQuery.scala | 31 -- .../geowave/ingest/IngestGeoTiff.scala | 91 ------ .../ingest/IngestGeoTiffMetadata.scala | 43 --- .../scala/geotrellis/geowave/package.scala | 19 -- .../geowave/utils/DoubleUtils.scala | 28 -- .../geowave/utils/GeodesicUtils.scala | 39 --- .../geotrellis/geowave/utils/ListUtils.scala | 55 ---- .../geotrellis/geowave/utils/package.scala | 23 -- geowave/src/test/resources/logback.xml | 31 -- .../src/test/resources/raster/all-ones.tif | Bin 7040 -> 0 bytes geowave/src/test/resources/reference.conf | 13 - .../geotrellis/geowave/TestEnvironment.scala | 35 -- .../GeoTrellisDataAdapterSPISpec.scala | 45 --- .../adapter/geotiff/GeoTiffAdapterSpec.scala | 153 --------- .../IMMultibandGeoTiffAdapterSpec.scala | 155 --------- ...lTemporalElevationGeoTiffAdapterSpec.scala | 246 -------------- .../SpatialTemporalGeoTiffAdapterSpec.scala | 206 ------------ .../raster/IMMultibandRasterAdapterSpec.scala | 154 --------- .../raster/MultibandRasterAdapterSpec.scala | 153 --------- .../geotrellis/geowave/dsl/MessagesSpec.scala | 173 ---------- .../geowave/dsl/VoxelBoundsSpec.scala | 68 ---- .../geowave/ingest/IngestGeoTiffSpec.scala | 303 ------------------ project/Dependencies.scala | 17 - project/Settings.scala | 54 +--- scripts/createHeaders.sh | 1 - scripts/geowaveTestDB.sh | 9 - 131 files changed, 4 insertions(+), 7602 deletions(-) delete mode 100644 docs/guide/vector-backends.rst delete mode 100644 geomesa/src/main/resources/reference.conf delete mode 100644 geomesa/src/main/scala/geotrellis/geomesa/geotools/FeatureToGeoMesaSimpleFeatureMethods.scala delete mode 100644 geomesa/src/main/scala/geotrellis/geomesa/geotools/GeoMesaImplicits.scala delete mode 100644 geomesa/src/main/scala/geotrellis/geomesa/geotools/GeometryToGeoMesaSimpleFeature.scala delete mode 100644 geomesa/src/main/scala/geotrellis/geomesa/geotools/package.scala delete mode 100644 geomesa/src/main/scala/geotrellis/spark/store/geomesa/GeoMesaFeatureReader.scala delete mode 100644 geomesa/src/main/scala/geotrellis/spark/store/geomesa/GeoMesaFeatureWriter.scala delete mode 100644 geomesa/src/main/scala/geotrellis/spark/store/geomesa/GeoMesaInstance.scala delete mode 100644 geomesa/src/main/scala/geotrellis/spark/store/geomesa/conf/GeoMesaConfig.scala delete mode 100644 geomesa/src/main/scala/geotrellis/spark/store/geomesa/package.scala delete mode 100644 geomesa/src/test/scala/geotrellis/geomesa/geotools/GeoMesaSimpleFeatureType.scala delete mode 100644 geomesa/src/test/scala/geotrellis/spark/store/geomesa/GeoMesaPersistenceSpec.scala delete mode 100644 geowave/Makefile delete mode 100644 geowave/README.md delete mode 100644 geowave/benchmark/README.md delete mode 100644 geowave/benchmark/src/main/resources/application.conf delete mode 100644 geowave/benchmark/src/main/resources/logback.xml delete mode 100644 geowave/benchmark/src/main/scala/geotrellis/geowave/BenchmarkEnvironment.scala delete mode 100644 geowave/benchmark/src/main/scala/geotrellis/geowave/IngestBenchmarkData.scala delete mode 100644 geowave/benchmark/src/main/scala/geotrellis/geowave/QueryBenchmark.scala delete mode 100644 geowave/docker-compose.override.yml delete mode 100755 geowave/docker-compose.yml delete mode 100644 geowave/docs/README.md delete mode 100644 geowave/docs/schemas/delete-message.md delete mode 100644 geowave/docs/schemas/index-message.md delete mode 100644 geowave/docs/schemas/ingest-message.md delete mode 100644 geowave/src/main/resources/META-INF/services/geotrellis.geowave.adapter.GeoTrellisDataAdapterProvider delete mode 100644 geowave/src/main/resources/META-INF/services/geotrellis.geowave.adapter.HandlersRegistryProvider delete mode 100644 geowave/src/main/resources/META-INF/services/org.locationtech.geowave.core.index.persist.PersistableRegistrySpi delete mode 100644 geowave/src/main/resources/META-INF/services/org.locationtech.geowave.core.store.spi.DimensionalityTypeProviderSpi delete mode 100644 geowave/src/main/resources/json/delete-message.schema.json delete mode 100644 geowave/src/main/resources/json/index-message.schema.json delete mode 100644 geowave/src/main/resources/json/ingest-message.schema.json delete mode 100644 geowave/src/main/resources/json/message.schema.json delete mode 100644 geowave/src/main/resources/reference.conf delete mode 100644 geowave/src/main/scala/geotrellis/geowave/GeoTrellisPersistableRegistry.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/Implicits.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/adapter/AvroFieldReader.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/adapter/AvroFieldWriter.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/adapter/DataTypeRegistry.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/adapter/ElevationFieldHandler.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/adapter/GeoTrellisDataAdapter.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/adapter/GeoTrellisDataAdapterProvider.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/adapter/GeometryFieldHandler.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/adapter/IndexFieldHandler.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/adapter/TimestampFieldHandler.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/adapter/geotiff/GeoTiffAdapter.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/adapter/geotiff/GeoTiffAdapterProvider.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/adapter/geotiff/GeoTiffFieldReader.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/adapter/geotiff/GeoTiffFieldWriter.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/adapter/geotiff/package.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/adapter/package.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/adapter/raster/MulitbandRasterAdapter.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/adapter/raster/MultibandRasterReader.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/adapter/raster/MultibandRasterWriter.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/adapter/raster/avro/Implicits.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/adapter/raster/avro/RasterCodec.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/adapter/raster/avro/package.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/api/SQueryBuilder.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/api/package.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/conf/Implicits.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/conf/StoreConfiguration.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/conf/package.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/dsl/DataAdapterParameters.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/dsl/DataTypeReader.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/dsl/DeleteParameters.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/dsl/IndexParameters.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/dsl/IngestParameters.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/dsl/Metadata.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/dsl/QueryConfiguration.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/dsl/TilingBounds.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/dsl/VoxelBounds.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/dsl/VoxelBounds2D.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/dsl/VoxelBounds3D.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/dsl/VoxelBounds4D.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/dsl/VoxelDimensions.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/dsl/avro/GeometryCodecs.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/dsl/avro/Implicits.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/dsl/avro/VoxelBoundsCodec.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/dsl/avro/VoxelDimensionsCodec.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/dsl/avro/package.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/dsl/json/Implicits.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/dsl/json/JsonValidator.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/dsl/json/JsonValidatorErrors.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/dsl/json/package.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/dsl/package.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/dsl/syntax/Implicits.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/dsl/syntax/package.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/index/SpatialTemporalElevationIndexBuilder.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/index/SpatialTemporalElevationIndexTypeProvider.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/index/SpatialTemporalElevationOptions.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/index/dimension/Elevation.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/index/dimension/ElevationDefinition.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/index/dimension/ElevationReader.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/index/dimension/ElevationWriter.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/index/field/ElevationField.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/index/query/ExplicitSpatialElevationQuery.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/index/query/ExplicitSpatialTemporalElevationQuery.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/ingest/ConfigureIndex.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/ingest/ExecuteQuery.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/ingest/IngestGeoTiff.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/ingest/IngestGeoTiffMetadata.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/package.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/utils/DoubleUtils.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/utils/GeodesicUtils.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/utils/ListUtils.scala delete mode 100644 geowave/src/main/scala/geotrellis/geowave/utils/package.scala delete mode 100644 geowave/src/test/resources/logback.xml delete mode 100644 geowave/src/test/resources/raster/all-ones.tif delete mode 100644 geowave/src/test/resources/reference.conf delete mode 100644 geowave/src/test/scala/geotrellis/geowave/TestEnvironment.scala delete mode 100644 geowave/src/test/scala/geotrellis/geowave/adapter/GeoTrellisDataAdapterSPISpec.scala delete mode 100644 geowave/src/test/scala/geotrellis/geowave/adapter/geotiff/GeoTiffAdapterSpec.scala delete mode 100644 geowave/src/test/scala/geotrellis/geowave/adapter/geotiff/IMMultibandGeoTiffAdapterSpec.scala delete mode 100644 geowave/src/test/scala/geotrellis/geowave/adapter/geotiff/SpatialTemporalElevationGeoTiffAdapterSpec.scala delete mode 100644 geowave/src/test/scala/geotrellis/geowave/adapter/geotiff/SpatialTemporalGeoTiffAdapterSpec.scala delete mode 100644 geowave/src/test/scala/geotrellis/geowave/adapter/raster/IMMultibandRasterAdapterSpec.scala delete mode 100644 geowave/src/test/scala/geotrellis/geowave/adapter/raster/MultibandRasterAdapterSpec.scala delete mode 100644 geowave/src/test/scala/geotrellis/geowave/dsl/MessagesSpec.scala delete mode 100644 geowave/src/test/scala/geotrellis/geowave/dsl/VoxelBoundsSpec.scala delete mode 100644 geowave/src/test/scala/geotrellis/geowave/ingest/IngestGeoTiffSpec.scala delete mode 100755 scripts/geowaveTestDB.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 62c26efb80..37ae9caba0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Disambiguate withBufferTileFocalMethods implicit preserving bin compatibility [#3422](https://github.com/locationtech/geotrellis/pull/3422) - Specialize Grid for Int and Long [#3428](https://github.com/locationtech/geotrellis/pull/3428) +- Move GeoWave and GeoMesa subproject to their own repositories [#3439](https://github.com/locationtech/geotrellis/pull/3439) ## [3.6.0] - 2021-04-30 diff --git a/README.md b/README.md index 60d3fba34f..36f3e66e9d 100644 --- a/README.md +++ b/README.md @@ -47,9 +47,7 @@ of published GeoTrellis packages includes: - `geotrellis-cassandra`: Cassandra store integration for GeoTrellis - `geotrellis-cassandra-spark`: Cassandra store integration for GeoTrellis + Spark - `geotrellis-gdal`: GDAL bindings for GeoTrellis -- `geotrellis-geomesa`: Experimental GeoMesa integration for GeoTrellis + Spark - `geotrellis-geotools`: Conversions to and from GeoTools Vector and Raster data -- `geotrellis-geowave`: Experimental GeoWave integration for GeoTrellis + Spark - `geotrellis-hbase`: HBase store integration for GeoTrellis - `geotrellis-hbase-spark`: HBase store integration for GeoTrellis + Spark - `geotrellis-layer`: Datatypes to describe sets of rasters diff --git a/build.sbt b/build.sbt index 73a094a944..bc77dc0b81 100644 --- a/build.sbt +++ b/build.sbt @@ -14,7 +14,6 @@ lazy val root = Project("geotrellis", file(".")) gdal, `gdal-spark`, geotools, - // geowave, hbase, `hbase-spark`, layer, @@ -167,16 +166,6 @@ lazy val geotools = project ) .settings(Settings.geotools) -lazy val geowave = project - .dependsOn(raster, store, `raster-testkit` % Test) - .settings(Settings.geowave) - -lazy val `geowave-benchmark` = (project in file("geowave/benchmark")) - .dependsOn(geowave) - .enablePlugins(JmhPlugin) - .settings(Settings.geowaveBenchmark) - .settings(publish / skip := true) - lazy val shapefile = project .dependsOn(raster, `raster-testkit` % Test) .settings(Settings.shapefile) diff --git a/docs/guide/module-hierarchy.rst b/docs/guide/module-hierarchy.rst index 7b2b6cbd05..339668d740 100644 --- a/docs/guide/module-hierarchy.rst +++ b/docs/guide/module-hierarchy.rst @@ -62,17 +62,6 @@ geotrellis-gdal-spark Contains geotrellis.raster.gdal.* integration tests for Spark. -geotrellis-geomesa ------------------- - -*Experimental.* GeoTrellis compatibility for the distributed feature -store `GeoMesa `__. - -*Provides:* ``geotrellis.geomesa.geotools.*`` -*Provides:* ``geotrellis.spark.store.geomesa.*`` - -- Save and load ``RDD``\ s of features to and from GeoMesa. - geotrellis-geotools ------------------- @@ -82,16 +71,6 @@ geotrellis-geotools *Provides:* ``geotrellis.geotools.*`` -geotrellis-geowave ------------------- - -*Experimental.* GeoTrellis compatibility for the distributed feature -store `GeoWave `__. - -*Provides:* ``geotrellis.spark.io.geowave.*`` - -- Provides `GeoTrellisDataAdapter` to store GeoTrellis raster tiles and other Avro encoded records through GeoWave `DataTypeAdapter` interface. - geotrellis-hbase ---------------- diff --git a/docs/guide/vector-backends.rst b/docs/guide/vector-backends.rst deleted file mode 100644 index a72c2ed07b..0000000000 --- a/docs/guide/vector-backends.rst +++ /dev/null @@ -1,82 +0,0 @@ -Vector Data Backends -******************** - -GeoTrellis supports two well-known distributed vector-feature stores: -`GeoMesa `__ and -`GeoWave `__. A question that -often arises in the vector processing world is: "Which should I use?" At -first glance, it can be hard to tell the difference, apart from "one is -Java and the other is Scala". The real answer is, of course, "it -depends". - -In the fall of 2016, our team was tasked with an official comparison of -the two. It was our goal to increase awareness of their respective -strengths and weaknesses, so that both teams can focus on their -strengths during development, and the public can make an easier choice. -We analysed a number of angles, including: - -- Feature set -- Performance -- Ease of use -- Project maturity - -The full report should be made public in Q1/Q2 of 2017. - -While developing applications directly with these projects is quite a -different experience, in terms of our GeoTrellis interfaces for each -project (as a vector data backend), they support essentially the same -feature set (GeoWave optionally supports reading/writing Raster layers). - -Keep in mind that as of 2016 October 25, both of these GeoTrellis -modules are still experimental. - -GeoMesa -======= - -.. code:: scala - - import geotrellis.spark._ - import geotrellis.spark.io._ - import geotrellis.spark.io.geomesa._ - - val instance: GeoMesaInstance( - tableName = ..., - instanceName = ..., - zookeepers = ..., - users = ..., - password = ..., - useMock = ... - ) - - val reader = new GeoMesaFeatureReader(instance) - val writer = new GeoMesaFeatureWriter(instance) - - val id: LayerId = ... - val query: Query = ... /* GeoMesa query type */ - - val spatialFeatureType: SimpleFeatureType = ... /* from geomesa - see their docs */ - - /* for some generic D, following GeoTrellis `Feature[G, D]` */ - val res: RDD[SimpleFeature] = reader.read[Point, D]( - id, - spatialFeatureType, - query - ) - -GeoWave -======= - -.. code:: scala - - import geotrellis.spark._ - import geotrellis.spark.io._ - import geotrellis.spark.io.geowave._ - - val res: RDD[Feature[G, Map[String, Object]]] = GeoWaveFeatureRDDReader.read( - zookeepers = ..., - accumuloInstanceName = ..., - accumuloInstanceUser = ..., - accumuloInstancePass = ..., - gwNamespace = ..., - simpleFeatureType = ... /* from geowave */ - ) diff --git a/docs/index.rst b/docs/index.rst index 6c68ed1928..43805f8dc8 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -129,7 +129,6 @@ Ready? `Setup a GeoTrellis development environment. `__ Extending GeoTrellis Types GeoTrellis Module Hierarchy Tile Layer Backends - Vector Data Backends Frequently Asked Questions Example Archive diff --git a/geomesa/src/main/resources/reference.conf b/geomesa/src/main/resources/reference.conf deleted file mode 100644 index b38b1005d5..0000000000 --- a/geomesa/src/main/resources/reference.conf +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2016 Azavea -# -# 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. - -geotrellis.geomesa.feature-type-cache-size=16 diff --git a/geomesa/src/main/scala/geotrellis/geomesa/geotools/FeatureToGeoMesaSimpleFeatureMethods.scala b/geomesa/src/main/scala/geotrellis/geomesa/geotools/FeatureToGeoMesaSimpleFeatureMethods.scala deleted file mode 100644 index 6a0db6b3d2..0000000000 --- a/geomesa/src/main/scala/geotrellis/geomesa/geotools/FeatureToGeoMesaSimpleFeatureMethods.scala +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2016 Azavea - * - * 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 geotrellis.geomesa.geotools - -import geotrellis.proj4.CRS -import geotrellis.util.annotations.experimental -import geotrellis.util.MethodExtensions -import geotrellis.vector.{Feature, Geometry} - -import org.opengis.feature.simple.SimpleFeature - -/** - * @define experimental EXPERIMENTAL@experimental - */ -@experimental trait FeatureToGeoMesaSimpleFeatureMethods[G <: Geometry, T] extends MethodExtensions[Feature[G, T]] { - - /** $experimental */ - @experimental def toSimpleFeature(featureName: String, featureId: Option[String] = None, crs: Option[CRS] = None)(implicit transmute: T => Seq[(String, Any)]): SimpleFeature = - GeometryToGeoMesaSimpleFeature(featureName, self.geom, featureId, crs, self.data) -} diff --git a/geomesa/src/main/scala/geotrellis/geomesa/geotools/GeoMesaImplicits.scala b/geomesa/src/main/scala/geotrellis/geomesa/geotools/GeoMesaImplicits.scala deleted file mode 100644 index 5e248f2cfa..0000000000 --- a/geomesa/src/main/scala/geotrellis/geomesa/geotools/GeoMesaImplicits.scala +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2016 Azavea - * - * 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 geotrellis.geomesa.geotools - -import geotrellis.util.MethodExtensions -import geotrellis.vector.{Feature, Geometry} -import geotrellis.util.annotations.experimental - -@experimental object GeoMesaImplicits extends GeoMesaImplicits - -@experimental trait GeoMesaImplicits { - implicit class withFeatureToGeoMesaSimpleFeatureMethods[G <: Geometry, T](val self: Feature[G, T]) - extends MethodExtensions[Feature[G, T]] - with FeatureToGeoMesaSimpleFeatureMethods[G, T] -} diff --git a/geomesa/src/main/scala/geotrellis/geomesa/geotools/GeometryToGeoMesaSimpleFeature.scala b/geomesa/src/main/scala/geotrellis/geomesa/geotools/GeometryToGeoMesaSimpleFeature.scala deleted file mode 100644 index 1cc38a7318..0000000000 --- a/geomesa/src/main/scala/geotrellis/geomesa/geotools/GeometryToGeoMesaSimpleFeature.scala +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2016 Azavea - * - * 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 geotrellis.geomesa.geotools - -import geotrellis.spark.store.geomesa.conf.GeoMesaConfig -import geotrellis.proj4.{CRS => GCRS} -import geotrellis.util.annotations.experimental -import geotrellis.vector._ -import com.github.blemale.scaffeine.{Cache, Scaffeine} -import org.geotools.feature.simple.{SimpleFeatureBuilder, SimpleFeatureTypeBuilder} -import org.locationtech.geomesa.utils.geotools.SimpleFeatureTypes -import org.opengis.feature.simple.{SimpleFeature, SimpleFeatureType} - -/** - * @define experimental EXPERIMENTAL@experimental - */ -@experimental -object GeometryToGeoMesaSimpleFeature { - - val whenField: String = "when" - val whereField: String = "the_geom" - val indexDtg: String = SimpleFeatureTypes.Configs.DEFAULT_DATE_KEY - - lazy val featureTypeCache: Cache[String, SimpleFeatureType] = - Scaffeine() - .recordStats() - .maximumSize(GeoMesaConfig.featureTypeCacheSize) - .build[String, SimpleFeatureType]() - - /** $experimental */ - @experimental - def apply(featureName: String, geom: Geometry, featureId: Option[String], crs: Option[GCRS], data: Seq[(String, Any)]): SimpleFeature = { - val sft = featureTypeCache.get(featureName, { key => - val sftb = (new SimpleFeatureTypeBuilder).minOccurs(1).maxOccurs(1).nillable(false) - - sftb.setName(featureName) - crs match { - case Some(crs) => sftb.setSRS(s"EPSG:${crs.epsgCode.get}") - case None => - } - geom match { - case pt: Point => sftb.add(whereField, classOf[Point]) - case ln: LineString => sftb.add(whereField, classOf[LineString]) - case pg: Polygon => sftb.add(whereField, classOf[Polygon]) - case mp: MultiPoint => sftb.add(whereField, classOf[MultiPoint]) - case ml: MultiLineString => sftb.add(whereField, classOf[MultiLineString]) - case mp: MultiPolygon => sftb.add(whereField, classOf[MultiPolygon]) - case g: Geometry => throw new Exception(s"Unhandled Geometry type $g") - } - sftb.setDefaultGeometry(whereField) - data.foreach({ case (key, value) => sftb - .minOccurs(1).maxOccurs(1).nillable(false) - .add(key, value.getClass) - }) - sftb.buildFeatureType - }) - - if(data.map(_._1).contains(whenField)) sft.getUserData.put(indexDtg, whenField) // when field is date - val sfb = new SimpleFeatureBuilder(sft) - - geom match { - case pt: Point => sfb.add(pt) - case ln: LineString => sfb.add(ln) - case pg: Polygon => sfb.add(pg) - case mp: MultiPoint => sfb.add(mp) - case ml: MultiLineString => sfb.add(ml) - case mp: MultiPolygon => sfb.add(mp) - case g: Geometry => throw new Exception(s"Unhandled GeoTrellis Geometry $g") - } - data.foreach({ case (key, value) => sfb.add(value) }) - - sfb.buildFeature(featureId.orNull) - } -} diff --git a/geomesa/src/main/scala/geotrellis/geomesa/geotools/package.scala b/geomesa/src/main/scala/geotrellis/geomesa/geotools/package.scala deleted file mode 100644 index c0fefe9ae2..0000000000 --- a/geomesa/src/main/scala/geotrellis/geomesa/geotools/package.scala +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2016 Azavea - * - * 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 geotrellis.geomesa - -package object geotools extends GeoMesaImplicits diff --git a/geomesa/src/main/scala/geotrellis/spark/store/geomesa/GeoMesaFeatureReader.scala b/geomesa/src/main/scala/geotrellis/spark/store/geomesa/GeoMesaFeatureReader.scala deleted file mode 100644 index d7899e7088..0000000000 --- a/geomesa/src/main/scala/geotrellis/spark/store/geomesa/GeoMesaFeatureReader.scala +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2016 Azavea - * - * 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 geotrellis.spark.store.geomesa - -import geotrellis.geotools._ -import geotrellis.spark._ -import geotrellis.util.annotations.experimental -import geotrellis.vector._ -import geotrellis.store.LayerId -import org.apache.accumulo.core.client.mapreduce.InputFormatBase -import org.apache.hadoop.io.Text -import org.apache.hadoop.mapreduce.Job -import org.apache.spark.rdd.RDD -import org.apache.spark.SparkContext -import org.geotools.data._ -import org.locationtech.geomesa.jobs.interop.mapreduce.GeoMesaAccumuloInputFormat -import org.opengis.feature.simple.{SimpleFeature, SimpleFeatureType} - -import scala.collection.JavaConverters._ -import scala.reflect.ClassTag - -/** - * @define experimental EXPERIMENTAL@experimental - */ -@experimental class GeoMesaFeatureReader(val instance: GeoMesaInstance) - (implicit sc: SparkContext) extends Serializable { - - /** $experimental */ - @experimental def readSimpleFeatures( - featureName: String, - simpleFeatureType: SimpleFeatureType, - query: Query, - numPartitions: Option[Int] = None - ): RDD[SimpleFeature] = { - val dataStore = instance.accumuloDataStore - try { - if (!dataStore.getTypeNames().contains(simpleFeatureType.getTypeName)) dataStore.createSchema(simpleFeatureType) - } finally dataStore.dispose() - - val job = Job.getInstance(sc.hadoopConfiguration) - GeoMesaAccumuloInputFormat.configure(job, instance.conf.asJava, query) - - if (numPartitions.isDefined) { - System.setProperty("geomesa.mapreduce.splits.max", numPartitions.get.toString) - InputFormatBase.setAutoAdjustRanges(job, false) - } - sc.newAPIHadoopRDD(job.getConfiguration, classOf[GeoMesaAccumuloInputFormat], classOf[Text], classOf[SimpleFeature]).map(U => U._2) - } - - /** $experimental */ - @experimental def read[G <: geotrellis.vector.Geometry: ClassTag, D] - (layerId: LayerId, simpleFeatureType: SimpleFeatureType, query: Query, numPartitions: Option[Int] = None) - (implicit transmute: Map[String, Any] => D): RDD[Feature[G, D]] = - readSimpleFeatures( - featureName = layerId.name, - simpleFeatureType = simpleFeatureType, - query = query, - numPartitions = numPartitions - ).map(_.toFeature[G, D]()) -} - -/** - * @define experimental EXPERIMENTAL@experimental - */ -@experimental object GeoMesaFeatureReader { - - /** $experimental */ - @experimental def apply(instance: GeoMesaInstance)(implicit sc: SparkContext): GeoMesaFeatureReader = new GeoMesaFeatureReader(instance) -} diff --git a/geomesa/src/main/scala/geotrellis/spark/store/geomesa/GeoMesaFeatureWriter.scala b/geomesa/src/main/scala/geotrellis/spark/store/geomesa/GeoMesaFeatureWriter.scala deleted file mode 100644 index 30cd2ba1b1..0000000000 --- a/geomesa/src/main/scala/geotrellis/spark/store/geomesa/GeoMesaFeatureWriter.scala +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2016 Azavea - * - * 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 geotrellis.spark.store.geomesa - -import geotrellis.geomesa.geotools._ -import geotrellis.spark._ -import geotrellis.util.annotations.experimental -import geotrellis.vector._ -import org.log4s._ -import geotrellis.store.LayerId -import org.apache.spark.rdd.RDD -import org.apache.spark.SparkContext -import org.geotools.data.Transaction -import org.opengis.feature.simple.SimpleFeatureType - -/** - * @define experimental EXPERIMENTAL@experimental - */ -@experimental class GeoMesaFeatureWriter(val instance: GeoMesaInstance) - (implicit sc: SparkContext) extends Serializable { - - /** $experimental */ - @experimental def write[G <: Geometry, D: * => Seq[(String, Any)]: λ[α => Feature[G, α] => FeatureToGeoMesaSimpleFeatureMethods[G, α]]] - (layerId: LayerId, simpleFeatureType: SimpleFeatureType, rdd: RDD[Feature[G, D]]): Unit = { - - val (sftTypeName, sftAttributeCount) = simpleFeatureType.getTypeName -> simpleFeatureType.getAttributeCount - // data store on a driver - val dataStore = instance.accumuloDataStore - try { - // register feature type and write features - if (!dataStore.getTypeNames().contains(sftTypeName)) dataStore.createSchema(simpleFeatureType) - } finally dataStore.dispose() - - rdd - .map(_.toSimpleFeature(layerId.name)) - .foreachPartition { partition => - // data store per partition - val dataStore = instance.accumuloDataStore - - // writer per partition - val featureWriter = dataStore.getFeatureWriterAppend(sftTypeName, Transaction.AUTO_COMMIT) - try { - partition.foreach { sf => - val newFeature = featureWriter.next() - (0 until sftAttributeCount).foreach(i => newFeature.setAttribute(i, sf.getAttribute(i))) - featureWriter.write() - } - } finally { - featureWriter.close(); dataStore.dispose() - } - } - } -} - -/** - * @define experimental EXPERIMENTAL@experimental - */ -@experimental object GeoMesaFeatureWriter { - - /** $experimental */ - @experimental def apply(instance: GeoMesaInstance)(implicit sc: SparkContext): GeoMesaFeatureWriter = - new GeoMesaFeatureWriter(instance) -} diff --git a/geomesa/src/main/scala/geotrellis/spark/store/geomesa/GeoMesaInstance.scala b/geomesa/src/main/scala/geotrellis/spark/store/geomesa/GeoMesaInstance.scala deleted file mode 100644 index 9f3e57d280..0000000000 --- a/geomesa/src/main/scala/geotrellis/spark/store/geomesa/GeoMesaInstance.scala +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2016 Azavea - * - * 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 geotrellis.spark.store.geomesa - -import geotrellis.util.annotations.experimental -import geotrellis.store.LayerId -import org.geotools.data.DataStoreFinder -import org.locationtech.geomesa.accumulo.data.AccumuloDataStore - -import scala.collection.JavaConverters._ - -/** - * @define experimental EXPERIMENTAL@experimental - */ -@experimental class GeoMesaInstance(val conf: Map[String, String]) - extends Serializable { - - val SEP = "__.__" - - def layerIdString(layerId: LayerId): String = s"${layerId.name}${SEP}${layerId.zoom}" - - def dataStore = DataStoreFinder.getDataStore(conf.asJava) - def accumuloDataStore = dataStore.asInstanceOf[AccumuloDataStore] -} - -/** - * @define experimental EXPERIMENTAL@experimental - */ -@experimental object GeoMesaInstance { - - /** $experimental */ - @experimental def apply(tableName: String, instanceName: String, zookeepers: String, user: String, password: String, mock: Boolean = false): GeoMesaInstance = { - new GeoMesaInstance(Map( - "accumulo.instance.id" -> instanceName, - "accumulo.zookeepers" -> zookeepers, - "accumulo.user" -> user, - "accumulo.password" -> password, - "accumulo.catalog" -> tableName, - "accumulo.mock" -> mock.toString - )) - } -} diff --git a/geomesa/src/main/scala/geotrellis/spark/store/geomesa/conf/GeoMesaConfig.scala b/geomesa/src/main/scala/geotrellis/spark/store/geomesa/conf/GeoMesaConfig.scala deleted file mode 100644 index 51c8ce9782..0000000000 --- a/geomesa/src/main/scala/geotrellis/spark/store/geomesa/conf/GeoMesaConfig.scala +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2018 Azavea - * - * 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 geotrellis.spark.store.geomesa.conf - -import pureconfig.generic.auto._ - -case class GeoMesaConfig(featureTypeCacheSize: Int = 16) - -object GeoMesaConfig { - lazy val conf: GeoMesaConfig = pureconfig.loadConfigOrThrow[GeoMesaConfig]("geotrellis.geomesa") - implicit def geoMesaConfigToClass(obj: GeoMesaConfig.type): GeoMesaConfig = conf -} \ No newline at end of file diff --git a/geomesa/src/main/scala/geotrellis/spark/store/geomesa/package.scala b/geomesa/src/main/scala/geotrellis/spark/store/geomesa/package.scala deleted file mode 100644 index 9e4145d4ce..0000000000 --- a/geomesa/src/main/scala/geotrellis/spark/store/geomesa/package.scala +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2016 Azavea - * - * 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 geotrellis.spark.store - -import geotrellis.geomesa.geotools._ -import geotrellis.util.annotations.experimental - -/** - * @define experimental EXPERIMENTAL@experimental - */ -package object geomesa extends GeoMesaImplicits { - - /** $experimental */ - @experimental implicit def mapToSeq[K, V](map: Map[K, V]): Seq[(K, V)] = map.toSeq -} diff --git a/geomesa/src/test/scala/geotrellis/geomesa/geotools/GeoMesaSimpleFeatureType.scala b/geomesa/src/test/scala/geotrellis/geomesa/geotools/GeoMesaSimpleFeatureType.scala deleted file mode 100644 index f68555c208..0000000000 --- a/geomesa/src/test/scala/geotrellis/geomesa/geotools/GeoMesaSimpleFeatureType.scala +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2016 Azavea - * - * 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 geotrellis.geomesa.geotools - -import geotrellis.spark.store.geomesa.conf.GeoMesaConfig -import geotrellis.vector.Geometry -import geotrellis.proj4.{WebMercator, CRS => GCRS} -import com.github.blemale.scaffeine.{Cache, Scaffeine} -import org.locationtech.jts.{geom => jts} -import org.geotools.feature.simple.SimpleFeatureTypeBuilder -import org.opengis.feature.simple.SimpleFeatureType - -import scala.reflect._ - -object GeoMesaSimpleFeatureType { - - val whenField: String = GeometryToGeoMesaSimpleFeature.whenField - val whereField: String = GeometryToGeoMesaSimpleFeature.whereField - val indexDtg: String = GeometryToGeoMesaSimpleFeature.indexDtg - - lazy val featureTypeCache: Cache[String, SimpleFeatureType] = - Scaffeine() - .recordStats() - .maximumSize(GeoMesaConfig.featureTypeCacheSize) - .build[String, SimpleFeatureType]() - - def apply[G <: Geometry: ClassTag](featureName: String, crs: Option[GCRS] = Some(WebMercator), temporal: Boolean = false): SimpleFeatureType = { - featureTypeCache.get(featureName, { key => - val sftb = (new SimpleFeatureTypeBuilder).minOccurs(1).maxOccurs(1).nillable(false) - - sftb.setName(featureName) - crs.foreach { crs => sftb.setSRS(s"EPSG:${crs.epsgCode.get}") } - classTag[G].runtimeClass.getName match { - case "geotrellis.vector.Point" => sftb.add(GeometryToGeoMesaSimpleFeature.whereField, classOf[jts.Point]) - case "geotrellis.vector.Line" => sftb.add(GeometryToGeoMesaSimpleFeature.whereField, classOf[jts.LineString]) - case "geotrellis.vector.Polygon" => sftb.add(GeometryToGeoMesaSimpleFeature.whereField, classOf[jts.Polygon]) - case "geotrellis.vector.MultiPoint" => sftb.add(GeometryToGeoMesaSimpleFeature.whereField, classOf[jts.MultiPoint]) - case "geotrellis.vector.MultiLine" => sftb.add(GeometryToGeoMesaSimpleFeature.whereField, classOf[jts.MultiLineString]) - case "geotrellis.vector.MultiPolygon" => sftb.add(GeometryToGeoMesaSimpleFeature.whereField, classOf[jts.MultiPolygon]) - case g => throw new Exception(s"Unhandled GeoTrellis Geometry $g") - } - sftb.setDefaultGeometry(whereField) - if (temporal) sftb.add(whenField, classOf[java.util.Date]) - val sft = sftb.buildFeatureType - if (temporal) sft.getUserData.put(indexDtg, whenField) // when field is date - sft - }) - } -} diff --git a/geomesa/src/test/scala/geotrellis/spark/store/geomesa/GeoMesaPersistenceSpec.scala b/geomesa/src/test/scala/geotrellis/spark/store/geomesa/GeoMesaPersistenceSpec.scala deleted file mode 100644 index cd6c8e1563..0000000000 --- a/geomesa/src/test/scala/geotrellis/spark/store/geomesa/GeoMesaPersistenceSpec.scala +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright 2016 Azavea - * - * 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 geotrellis.spark.store.geomesa - -import geotrellis.geomesa.geotools.{GeoMesaSimpleFeatureType, GeometryToGeoMesaSimpleFeature} -import geotrellis.vector._ -import geotrellis.spark.testkit.TestEnvironment -import org.opengis.filter.Filter -import org.apache.spark.rdd.RDD -import org.geotools.data.Query -import org.geotools.filter.text.ecql.ECQL -import org.scalatest.{BeforeAndAfterAll, FunSpec, Matchers, Suite} -import java.text.SimpleDateFormat -import java.util.TimeZone - -import geotrellis.store.LayerId - -class GeoMesaPersistenceSpec extends FunSpec with Suite with BeforeAndAfterAll with Matchers with TestEnvironment { - - describe("GeoMesa Features Spec") { - val featuresInstance = GeoMesaInstance( - tableName = "features", - instanceName = "fake", - zookeepers = "localhost", - user = "root", - password = "", - mock = true - ) - - val featuresTemporalInstance = GeoMesaInstance( - tableName = "featuresTemporal", - instanceName = "fake", - zookeepers = "localhost", - user = "root", - password = "", - mock = true - ) - - val layerWriter = new GeoMesaFeatureWriter(featuresInstance) - val layerReader = new GeoMesaFeatureReader(featuresInstance) - val layerWriterTemporal = new GeoMesaFeatureWriter(featuresTemporalInstance) - val layerReaderTemporal = new GeoMesaFeatureReader(featuresTemporalInstance) - - val sdf = { - val df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") - df.setTimeZone(TimeZone.getTimeZone("UTC")); df - } - - val dates = (1 to 100).map { x => - val day = { val i = x / 10; if(i == 0) "01" else if (i < 10) s"0$i" else s"$i" } - day.toInt -> sdf.parse(s"2010-05-${day}T00:00:00.000Z") - } - - val features: Array[Feature[Point, Map[String, Any]]] = (1 to 100).map { x: Int => Feature(Point(x, 40), Map[String, Any]()) }.toArray - val featuresTemporal: Array[Feature[Point, Map[String, Any]]] = - (1 to 100).zip(dates).map { case (x, (day, strDay)) => - Feature(Point(x, 40), Map[String, Any](GeometryToGeoMesaSimpleFeature.whenField -> strDay)) }.toArray - val featuresRDD: RDD[Feature[Point, Map[String, Any]]] = sc.parallelize(features) - val featuresTemporalRDD: RDD[Feature[Point, Map[String, Any]]] = sc.parallelize(featuresTemporal) - - val spatialFeatureName = "spatialFeature" - val spaceTimeFeatureName = "spaceTimeFeature" - - val spatialFeatureType = GeoMesaSimpleFeatureType[Point](spatialFeatureName) - val spaceTimeFeatureType = GeoMesaSimpleFeatureType[Point](spaceTimeFeatureName, temporal = true) - - it("should not find layer before write") { - val res = layerReader.read[Point, Map[String, Any]](LayerId(spatialFeatureName, 0), spatialFeatureType, new Query(spatialFeatureName, Filter.INCLUDE)) - val resTemporal = layerReaderTemporal.read[Point, Map[String, Any]](LayerId(spaceTimeFeatureName, 0), spaceTimeFeatureType, new Query(spaceTimeFeatureName, Filter.INCLUDE)) - res.count() shouldBe 0 - resTemporal.count() shouldBe 0 - } - - it("should write a layer") { - layerWriter.write(LayerId(spatialFeatureName, 0), spatialFeatureType, featuresRDD) - layerWriterTemporal.write(LayerId(spaceTimeFeatureName, 0), spaceTimeFeatureType, featuresTemporalRDD) - } - - it("should read a layer back") { - val actual = - layerReader - .read[Point, Map[String, Any]](LayerId(spatialFeatureName, 0), spatialFeatureType, new Query(spatialFeatureName, Filter.INCLUDE)) - .collect() - - if (features.diff(actual).nonEmpty) - info(s"missing: ${(features diff actual).toList}") - if (actual.diff(features).nonEmpty) - info(s"unwanted: ${(actual diff features).toList}") - - actual should contain theSameElementsAs features - } - - it("should read a temporal layer back") { - val actual = - layerReaderTemporal - .read[Point, Map[String, Any]](LayerId(spaceTimeFeatureName, 0), spaceTimeFeatureType, new Query(spaceTimeFeatureName, Filter.INCLUDE)) - .collect() - - if (featuresTemporal.diff(actual).nonEmpty) - info(s"missing: ${(featuresTemporal diff actual).toList}") - if (actual.diff(featuresTemporal).nonEmpty) - info(s"unwanted: ${(actual diff featuresTemporal).toList}") - - actual should contain theSameElementsAs featuresTemporal - } - - it("should query a temporal layer") { - // difference in during and between words: - // https://github.com/locationtech/geomesa/blob/master/geomesa-filter/src/test/scala/org/locationtech/geomesa/filter/FilterHelperTest.scala#L99-L100 - - val ds = dates.filter { case (k, _) => k > 3 && k < 6 } - val expectedLength = ds.length - val filter = ECQL.toFilter(s"${GeometryToGeoMesaSimpleFeature.whenField} between '${sdf.format(ds.head._2)}' and '${sdf.format(ds.last._2)}'") - - val actual = - layerReaderTemporal - .read[Point, Map[String, Any]](LayerId(spaceTimeFeatureName, 0), spaceTimeFeatureType, new Query(spaceTimeFeatureName, filter)) - .collect() - - actual.length shouldBe expectedLength - } - } -} diff --git a/geowave/Makefile b/geowave/Makefile deleted file mode 100644 index 459c20107e..0000000000 --- a/geowave/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -cqlsh: - docker exec -it $(FOLDER)_cassandra_1 cqlsh \ No newline at end of file diff --git a/geowave/README.md b/geowave/README.md deleted file mode 100644 index e6dccc79b5..0000000000 --- a/geowave/README.md +++ /dev/null @@ -1,55 +0,0 @@ -# GeoTrellis/GeoWave Connector - -GeoTrellis/GeoWave connector for storing raster and volumetric data. - -- [GeoTrellis/GeoWave Connector](#geotrellisgeowave-connector) - - [Requirements](#requirements) - - [Project Inventory](#project-inventory) - - [Development](#development) - - [!Important](#important) - - [Executing Tests](#executing-tests) -## Requirements - -- Docker Engine 17.12+ -- Docker Compose 1.21+ -- OpenJDK 8 - -## Project Inventory - -- `src` - Main project with `GeoTrellisDataAdapter` enabling storing GeoTrellis types with GeoWave -- `benchmark` - Skeleton for microbenchmarks on GeoWave queries -- `docs` - Overview of GeoWave concepts relevant to index and data adapter usage - -## Development - -### !Important - -After merging PRs / fetching changes from master and other branches be sure that you _recreated_ -dev env. Any changes introduced into interfaces that are present in the `Persistable Registry` -and have `fromBinary` and `toBinary`methods can cause serialization / deserialization issues -in tests and as a consequence tests would fail with various of unpredictable runtime exceptions. - -### Executing Tests - -Tests are dependent on Apache Cassandra, Kafka, ZooKeeper, and Graphite with Grafana. First, ensure -these dependencies are running: - -```bash -docker-compose up -d cassandra -``` - -Now, you can execute tests from project root: - -```bash -$ ./sbt "project geowave" test -... -[info] All tests passed. -[success] Total time: 72 s, completed Nov 22, 2019 11:48:25 AM -``` - -When you're done, ensure that the services and networks created by Docker -Compose are torn down: - -```bash -docker-compose down -``` \ No newline at end of file diff --git a/geowave/benchmark/README.md b/geowave/benchmark/README.md deleted file mode 100644 index 8e16674d87..0000000000 --- a/geowave/benchmark/README.md +++ /dev/null @@ -1,99 +0,0 @@ -# JMH Benchmarks - -## Instructions - -1. Make the following cassandra changes: -```yaml -cassandra: - image: cassandra:3.11 - environment: - - MAX_HEAP_SIZE=4G - - HEAP_NEWSIZE=800M - - CASSANDRA_LISTEN_ADDRESS=127.0.0.1 - mem_limit: 8G - memswap_limit: -1 -``` -2. Ingest data into Cassandra via `sbt "project geowave-benchmark" run` -3. Run benchmarks via `jmh:run -i 5 -wi 5 -f1 -t1 .*QueryBenchmark.*` -It is recommend to run run benchmarks via `jmh:run -i 20 -wi 10 -f1 -t1 .*QueryBenchmark.*` -(to do at least 10 warm up iterations and 20 of actual iterations, just to get a bit more consistent results). - -## Results - -

-jmh:run -i 20 -wi 10 -f 1 -t 1 .*QueryBenchmark.*
-
-88 Entries
-Benchmark                                             Mode  Cnt  Score   Error  Units
-entireSpatialGeometryQuery                             avgt   20  5.278 ± 0.643   s/op
-entireSpatialQuery                                        avgt   20  1.155 ± 0.057   s/op
-entireSpatialTemporalElevationElevationQuery              avgt   20  1.145 ± 0.069   s/op
-entireSpatialTemporalElevationGeometryQuery               avgt   20  1.089 ± 0.030   s/op
-entireSpatialTemporalElevationGeometryTemporalElevationQuery  avgt   20  5.963 ± 0.358   s/op
-entireSpatialTemporalElevationGeometryTemporalQuery       avgt   20  1.093 ± 0.042   s/op
-entireSpatialTemporalElevationQuery                       avgt   20  1.117 ± 0.033   s/op
-entireSpatialTemporalElevationTemporalQuery               avgt   20  1.080 ± 0.029   s/op
-entireSpatialTemporalGeometryQuery                        avgt   20  1.117 ± 0.039   s/op
-entireSpatialTemporalGeometryTemporalQuery             avgt   20  4.223 ± 0.213   s/op
-entireSpatialTemporalQuery                                avgt   20  1.072 ± 0.036   s/op
-entireSpatialTemporalTemporalQuery                        avgt   20  1.110 ± 0.039   s/op
-
-328 Entries
-Benchmark                                             Mode  Cnt   Score   Error  Units
-entireSpatialGeometryQuery                            avgt   20   4.705 ± 0.146   s/op
-entireSpatialQuery                                       avgt   20   5.249 ± 0.503   s/op
-entireSpatialTemporalElevationElevationQuery             avgt   20   4.919 ± 0.310   s/op
-entireSpatialTemporalElevationGeometryQuery              avgt   20   4.688 ± 0.251   s/op
-entireSpatialTemporalElevationGeometryTemporalElevationQuery  avgt   20  15.801 ± 6.629   s/op
-entireSpatialTemporalElevationGeometryTemporalQuery      avgt   20   5.212 ± 0.467   s/op
-entireSpatialTemporalElevationQuery                      avgt   20   5.256 ± 1.107   s/op
-entireSpatialTemporalElevationTemporalQuery              avgt   20   4.878 ± 0.324   s/op
-entireSpatialTemporalGeometryQuery                       avgt   20   4.760 ± 0.498   s/op
-entireSpatialTemporalGeometryTemporalQuery            avgt   20   4.272 ± 0.126   s/op
-entireSpatialTemporalQuery                               avgt   20   4.553 ± 0.275   s/op
-entireSpatialTemporalTemporalQuery                       avgt   20   4.736 ± 0.290   s/op
-
- -## Interpretation: - -The index type does affect the query performance. -The more dimensions there are defined for the index, the more ranges -would be generated for the SFC and the more range requests would be sent to Cassandra. -All ranged queries are marked as bold in benchmark results, all other benchmarks generate -full scan queries. - -Full scan by a three dimensional index is more expensive than by a single -or two dimensional index. The more dimensions SFC has, the more ranges would be generated. - -These benchmarks are not representative since were done with a local instance of Cassandra -and demonstrate only the local relative performance that shows how the Query performance -depends on the index type and the amount of data. In fact it is a Cassandra instance benchmark, -though it can give some general sense of how index and query types affect the performance. - -This benchmark measures in fact only full table scans (done via multiple ranged select queries or -via a single select). - -In the `entireSpatialTemporalElevationGeometryTemporalElevationQuery` case the results -are a bit high: too many range queries are generated and it is hard for a single Cassandra instance -to handle them. - -### Legend: -- `entireSpatial({Temporal|TemporalElevation})` performs a full table scan: - ```genericsql - SELECT * FROM QueryBench.indexName; - ``` -- In all cases where the query contains not all the index dimensions - (for instance a spatial query only from the spatial temporal indexed table), - GeoWave performs a full table scan: - ```genericsql - SELECT * FROM QueryBench.indexName; - ``` -- In all cases where the query contains all the index dimensions defined for the table, - GeoWave performs multiple ranged queries (number of SFC splits depends on the index dimensionality), - **benchmarks that generate such queries are marked as bold in the JMH report**: - ```genericsql - SELECT * FROM QueryBench.indexName - WHERE partition=:partition_val - AND adapter_id IN :adapter_id_val - AND sort>=:sort_min AND sort<:sort_max; - ``` \ No newline at end of file diff --git a/geowave/benchmark/src/main/resources/application.conf b/geowave/benchmark/src/main/resources/application.conf deleted file mode 100644 index 206db2de56..0000000000 --- a/geowave/benchmark/src/main/resources/application.conf +++ /dev/null @@ -1,12 +0,0 @@ -geotrellis.geowave.connection.store { - data-store-type = "cassandra" - options = { - "contactPoints": "localhost", - "contactPoints": ${?CASSANDRA_HOST}, - "gwNamespace" : "geotrellis" - } -} - -geotrellis.blocking-thread-pool { - threads = default -} diff --git a/geowave/benchmark/src/main/resources/logback.xml b/geowave/benchmark/src/main/resources/logback.xml deleted file mode 100644 index 053890d2d2..0000000000 --- a/geowave/benchmark/src/main/resources/logback.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - %white(%d{HH:mm:ss.SSS}) %highlight(%-5level) %cyan(%logger{50}) - %msg %n - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/geowave/benchmark/src/main/scala/geotrellis/geowave/BenchmarkEnvironment.scala b/geowave/benchmark/src/main/scala/geotrellis/geowave/BenchmarkEnvironment.scala deleted file mode 100644 index d615f01b19..0000000000 --- a/geowave/benchmark/src/main/scala/geotrellis/geowave/BenchmarkEnvironment.scala +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2021 Azavea - * - * 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 geotrellis.geowave - -import cats.effect.{ContextShift, IO, Timer} -import geotrellis.store.util.BlockingThreadPool - -import scala.util.Properties - -trait BenchmarkEnvironment { - val kafka: String = Properties.envOrElse("KAFKA_HOST", "localhost:9092") - val cassandra: String = Properties.envOrElse("CASSANDRA_HOST", "localhost") - - implicit val contextShift: ContextShift[IO] = IO.contextShift(BlockingThreadPool.executionContext) - implicit val timer: Timer[IO] = IO.timer(BlockingThreadPool.executionContext) -} diff --git a/geowave/benchmark/src/main/scala/geotrellis/geowave/IngestBenchmarkData.scala b/geowave/benchmark/src/main/scala/geotrellis/geowave/IngestBenchmarkData.scala deleted file mode 100644 index 4f04d0baf3..0000000000 --- a/geowave/benchmark/src/main/scala/geotrellis/geowave/IngestBenchmarkData.scala +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2021 Azavea - * - * 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 geotrellis.geowave - -import geotrellis.geowave.dsl.syntax._ -import geotrellis.geowave.index.SpatialTemporalElevationIndexBuilder -import org.locationtech.geowave.core.geotime.index.api.{SpatialIndexBuilder, SpatialTemporalIndexBuilder} -import org.locationtech.geowave.core.store.api.{DataStoreFactory, Writer} -import org.locationtech.geowave.datastore.cassandra.config.{CassandraOptions, CassandraRequiredOptions} -import org.locationtech.geowave.datastore.cassandra.util.SessionPool -import cats.syntax.flatMap._ -import cats.syntax.parallel._ -import cats.instances.list._ -import cats.effect.IO -import geotrellis.geowave.adapter.geotiff.GeoTiffAdapter -import geotrellis.raster.io.geotiff.GeoTiff -import geotrellis.raster.MultibandTile -import geotrellis.store.util.BlockingThreadPool - -object IngestBenchmarkData extends BenchmarkEnvironment { - def main(args: Array[String]): Unit = { - val n: Int = args.headOption.map(_.toInt).getOrElse(20) - - val spatialIndex = new SpatialIndexBuilder().createIndex - val spatialTemporalIndex = new SpatialTemporalIndexBuilder().createIndex - val spatialTemporalDepthIndex = new SpatialTemporalElevationIndexBuilder().createIndex - - val dataTypeAdapter = new GeoTiffAdapter("QueryBench".typeName) - val geowaveDataStore = DataStoreFactory.createDataStore(new CassandraRequiredOptions(cassandra, "QueryBench", new CassandraOptions())) - geowaveDataStore.addType(dataTypeAdapter, spatialIndex, spatialTemporalIndex, spatialTemporalDepthIndex) - - val data: IO[List[GeoTiff[MultibandTile]]] = ??? - val result = (data >>= { tiles => - tiles.map { tile => IO { - val indexWriter: Writer[GeoTiff[MultibandTile]] = geowaveDataStore.createWriter(dataTypeAdapter.getTypeName) - try indexWriter.write(tile) finally if (indexWriter != null) indexWriter.close() - tile - } }.parSequence }).unsafeRunSync() - - val session = SessionPool.getInstance().getSession(cassandra) - val cluster = session.getCluster - session.close() - cluster.close() - BlockingThreadPool.pool.shutdown() - - println(Console.RED) - println("-----------------------------") - println(s"Ingested Items: ${result.length}") - println("-----------------------------") - println(Console.RESET) - } -} diff --git a/geowave/benchmark/src/main/scala/geotrellis/geowave/QueryBenchmark.scala b/geowave/benchmark/src/main/scala/geotrellis/geowave/QueryBenchmark.scala deleted file mode 100644 index 7b736b261d..0000000000 --- a/geowave/benchmark/src/main/scala/geotrellis/geowave/QueryBenchmark.scala +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright 2021 Azavea - * - * 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 geotrellis.geowave - -import geotrellis.geowave.dsl.syntax._ -import geotrellis.geowave.index.SpatialTemporalElevationIndexBuilder -import geotrellis.geowave.index.dimension.ElevationDefinition -import geotrellis.geowave.index.query.ExplicitSpatialTemporalElevationQuery -import geotrellis.geowave.adapter.TypeName -import geotrellis.geowave.api._ -import geotrellis.vector._ -import geotrellis.raster.io.geotiff.GeoTiff -import geotrellis.raster.MultibandTile -import geotrellis.store.util.BlockingThreadPool - -import org.locationtech.geowave.core.geotime.index.api.{SpatialIndexBuilder, SpatialTemporalIndexBuilder} -import org.locationtech.geowave.core.store.api.{DataStore, DataStoreFactory, Index} -import org.locationtech.geowave.datastore.cassandra.config.{CassandraOptions, CassandraRequiredOptions} -import org.locationtech.geowave.core.geotime.store.query.{ExplicitSpatialQuery, ExplicitSpatialTemporalQuery} -import org.locationtech.geowave.core.store.CloseableIterator -import org.locationtech.geowave.datastore.cassandra.util.SessionPool -import org.locationtech.geowave.core.geotime.index.dimension.{SimpleTimeDefinition, TimeDefinition} -import org.locationtech.geowave.core.index.sfc.data.NumericRange -import org.locationtech.geowave.core.store.query.constraints.BasicQueryByClass -import org.locationtech.geowave.core.store.query.constraints.BasicQueryByClass.{ConstraintData, ConstraintSet, ConstraintsByClass} -import org.openjdk.jmh.annotations._ - -import scala.collection.JavaConverters._ -import java.util.concurrent.TimeUnit -import java.time.{LocalDate, ZoneOffset} -import java.util.Date - -@BenchmarkMode(Array(Mode.AverageTime)) -@State(Scope.Benchmark) -@OutputTimeUnit(TimeUnit.SECONDS) -@Timeout(time = 10, timeUnit = TimeUnit.MINUTES) -class QueryBenchmark extends BenchmarkEnvironment { - var uri: String = _ - - var spatialIndex: Index = _ - var spatialTemporalIndex: Index = _ - var spatialTemporalElevationIndex: Index = _ - - var typeName: TypeName = _ - var geowaveDataStore: DataStore = _ - - var entireGeometry: Geometry = _ - - @Setup(Level.Trial) - def setupData(): Unit = { - spatialIndex = new SpatialIndexBuilder().createIndex - spatialTemporalIndex = new SpatialTemporalIndexBuilder().createIndex - spatialTemporalElevationIndex = new SpatialTemporalElevationIndexBuilder().createIndex - - typeName = "BenchType".typeName - geowaveDataStore = DataStoreFactory.createDataStore( - new CassandraRequiredOptions(cassandra, "BenchKeyspace", new CassandraOptions())) - } - - @TearDown(Level.Trial) - def tearDown(): Unit = { - val session = SessionPool.getInstance().getSession(cassandra) - val cluster = session.getCluster - session.close() - cluster.close() - BlockingThreadPool.pool.shutdown() - } - - private def indexQuery(indexName: String) = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(typeName.value) - .indexName(indexName) - - private def spatialQuery(indexName: String) = { - val sq = new ExplicitSpatialQuery(entireGeometry) - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(typeName.value) - .indexName(indexName) - .constraints(sq) - } - - private def spatialTemporalQuery(indexName: String) = { - val date = Date.from(LocalDate.of(2000, 1, 1).atStartOfDay.toInstant(ZoneOffset.UTC)) - val sq = new ExplicitSpatialTemporalQuery(date, date, entireGeometry) - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(typeName.value) - .indexName(indexName) - .constraints(sq) - } - - private def spatialTemporalElevationQuery(indexName: String) = { - val minDate = Date.from(LocalDate.ofYearDay(1970, 1).atStartOfDay(ZoneOffset.UTC).toInstant) - val maxDate = Date.from(LocalDate.ofYearDay(2010, 1).atStartOfDay(ZoneOffset.UTC).toInstant) - val minElevation = 0d - val maxElevation = 25000d - val sq = ExplicitSpatialTemporalElevationQuery(minElevation, maxElevation, minDate, maxDate, entireGeometry) - - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(typeName.value) - .indexName(indexName) - .constraints(sq) - } - - private def temporalQuery(indexName: String) = { - val timeRange = new NumericRange( - LocalDate.ofYearDay(1970, 1).atStartOfDay(ZoneOffset.UTC).toInstant.toEpochMilli.toDouble, - LocalDate.ofYearDay(2010, 1).atStartOfDay(ZoneOffset.UTC).toInstant.toEpochMilli.toDouble - ) - val tc = new BasicQueryByClass(new ConstraintsByClass( - new ConstraintSet( - new ConstraintData(timeRange, false), - classOf[TimeDefinition], - classOf[SimpleTimeDefinition] - ) - )) - - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(typeName.value) - .indexName(indexName) - .constraints(tc) - } - - private def elevationQuery(indexName: String) = { - val dc = new BasicQueryByClass(new ConstraintsByClass( - new ConstraintSet( - new ConstraintData(new NumericRange(0d, 25000d), false), - classOf[ElevationDefinition] - ) - )) - - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(typeName.value) - .indexName(indexName) - .constraints(dc) - } - - @Benchmark - def entireSpatialQuery(): List[GeoTiff[MultibandTile]] = { - val iter: CloseableIterator[GeoTiff[MultibandTile]] = - geowaveDataStore.query(indexQuery(spatialIndex.getName).build) - iter.asScala.toList - } - - @Benchmark - def entireSpatialTemporalQuery(): List[GeoTiff[MultibandTile]] = { - val iter: CloseableIterator[GeoTiff[MultibandTile]] = - geowaveDataStore.query(indexQuery(spatialTemporalIndex.getName).build) - iter.asScala.toList - } - - @Benchmark - def entireSpatialTemporalElevationQuery(): List[GeoTiff[MultibandTile]] = { - val iter: CloseableIterator[GeoTiff[MultibandTile]] = - geowaveDataStore.query(indexQuery(spatialTemporalElevationIndex.getName).build) - iter.asScala.toList - } - - @Benchmark - def entireSpatialGeometryQuery(): List[GeoTiff[MultibandTile]] = { - val iter: CloseableIterator[GeoTiff[MultibandTile]] = - geowaveDataStore.query(spatialQuery(spatialIndex.getName).build) - iter.asScala.toList - } - - @Benchmark - def entireSpatialTemporalGeometryQuery(): List[GeoTiff[MultibandTile]] = { - val iter: CloseableIterator[GeoTiff[MultibandTile]] = - geowaveDataStore.query(spatialQuery(spatialTemporalIndex.getName).build) - iter.asScala.toList - } - - @Benchmark - def entireSpatialTemporalElevationGeometryQuery(): List[GeoTiff[MultibandTile]] = { - val iter: CloseableIterator[GeoTiff[MultibandTile]] = - geowaveDataStore.query(spatialQuery(spatialTemporalElevationIndex.getName).build) - iter.asScala.toList - } - - @Benchmark - def entireSpatialTemporalGeometryTemporalQuery(): List[GeoTiff[MultibandTile]] = { - val iter: CloseableIterator[GeoTiff[MultibandTile]] = - geowaveDataStore.query(spatialTemporalQuery(spatialTemporalIndex.getName).build) - iter.asScala.toList - } - - @Benchmark - def entireSpatialTemporalElevationGeometryTemporalQuery(): List[GeoTiff[MultibandTile]] = { - val iter: CloseableIterator[GeoTiff[MultibandTile]] = - geowaveDataStore.query(spatialTemporalQuery(spatialTemporalElevationIndex.getName).build) - iter.asScala.toList - } - - @Benchmark - def entireSpatialTemporalElevationGeometryTemporalElevationQuery(): List[GeoTiff[MultibandTile]] = { - val iter: CloseableIterator[GeoTiff[MultibandTile]] = - geowaveDataStore.query(spatialTemporalElevationQuery(spatialTemporalElevationIndex.getName).build) - iter.asScala.toList - } - - @Benchmark - def entireSpatialTemporalTemporalQuery(): List[GeoTiff[MultibandTile]] = { - val iter: CloseableIterator[GeoTiff[MultibandTile]] = - geowaveDataStore.query(temporalQuery(spatialTemporalIndex.getName).build) - iter.asScala.toList - } - - @Benchmark - def entireSpatialTemporalElevationTemporalQuery(): List[GeoTiff[MultibandTile]] = { - val iter: CloseableIterator[GeoTiff[MultibandTile]] = - geowaveDataStore.query(temporalQuery(spatialTemporalElevationIndex.getName).build) - iter.asScala.toList - } - - @Benchmark - def entireSpatialTemporalElevationElevationQuery(): List[GeoTiff[MultibandTile]] = { - val iter: CloseableIterator[GeoTiff[MultibandTile]] = - geowaveDataStore.query(elevationQuery(spatialTemporalElevationIndex.getName).build) - iter.asScala.toList - } -} diff --git a/geowave/docker-compose.override.yml b/geowave/docker-compose.override.yml deleted file mode 100644 index 7260463a52..0000000000 --- a/geowave/docker-compose.override.yml +++ /dev/null @@ -1,9 +0,0 @@ -version: "2.4" -services: - cassandra: - ports: - - "7199:7199" - - "7000:7000" - - "7001:7001" - - "9160:9160" - - "9042:9042" diff --git a/geowave/docker-compose.yml b/geowave/docker-compose.yml deleted file mode 100755 index 5b8d4d06aa..0000000000 --- a/geowave/docker-compose.yml +++ /dev/null @@ -1,13 +0,0 @@ -version: "2.4" -services: - cassandra: - image: cassandra:3.11 - environment: - - MAX_HEAP_SIZE=500M - - HEAP_NEWSIZE=100M - - CASSANDRA_LISTEN_ADDRESS=127.0.0.1 - mem_limit: 1G - memswap_limit: -1 - # Uncomment for benchmarks to avoid re-ingesting for each run - # volumes: - # - /data/cassandra:/var/lib/cassandra diff --git a/geowave/docs/README.md b/geowave/docs/README.md deleted file mode 100644 index cb9a8a4fa9..0000000000 --- a/geowave/docs/README.md +++ /dev/null @@ -1,173 +0,0 @@ -# Index - -This document covers the concepts and practice behind creating a custom data adapter and index. - -## DataTypeAdapter - -GeoWave [DataTypeAdapter](https://locationtech.github.io/geowave/devguide.html#adapters) is responsible for - -* Encoding/Decoding records -* Extracting index values from records -* Extracting unique data id from records - - -In GeoWave, `Adapter` is an object that can extract index and data values from the input entry and can -also write / read data type to / from the data base. Each adapter has a list of `Field Handler`s. - -`Field handler` is a special function that extracts values from the entry. For example, it can extract `Extent` or `Time` from a `MultibandGeoTiff`. - -Each `Adapter` has a name, that should be unique per Cassandra `namespace`. -In this project all adapters extend [`GeoTrellisDataAdapter`] which implements some of the common behavior. - -### DataTypeAdapter Lifetime - -In order to use the adapter it needs to be bound with one or more instances of an index. - -```scala -val geowaveDataStore: DataStore = DataStoreFactory.createDataStore( - new CassandraRequiredOptions("cassandraHost", "my_keyspace", new CassandraOptions())) - -// Create an adapter that can extract Spatial, Temporal and Elevation values from GeoTiff for indexing. -// The adapter also has a name ("GeoTiffAdapterSpec"), which should be unique in the Cassandra namespace. -val dataTypeAdapter = new GeoTiffAdapater("GeoTiffTiles".typeName) -val index: Index = new SpatialDimensionalityTypeProvider.SpatialIndexBuilder().createIndex - -// Add the newly constructed adapter to the data store. The adapter along with all handlers, primitives, -// and the index, will be serialized and stored in the DB. -dataStore.addType(adapter, index) - -val writer = dataStore.createWriter[GeoTiff[MultibandTile]]("GeoTiffTiles") -val tiff: GeoTiff[MultibandTile] = ??? -writer.write(tiff) -writer.close() -``` - -During the call to `addType` method the adapter and provided indices are serialized and stored to the database. -From that point on they are functionally immutable. Both readers and writers are created from the type name. -That process reads the serialized adapter from the database and uses it to produce reader/writer instances. - -Each index is associated with a table in cassandra. Writing to given type will result in duplicate records being written to each index table. -During query the appropriate table will be selected based on query parameters. - -When multiple types are using the same index they are written to the same table. -That is a single GeoWave table is able to contain data from multiple adapters. - -#### The internal DB structure - -The structures in this section are generated by the command above. -As the result, the following structure in Cassandra would be generated: - -```sh -docker-compose exec cassandra cqlsh -``` - -``` -cqlsh> describe tables; - -Keyspace my_keyspace ---------------------------- -index_geowave_metadata sp_temp_dpt_idx_balanced_year_2147483647 -aim_geowave_metadata internal_adapter_geowave_metadata -adapter_geowave_metadata -``` - -- `index_geowave_metadata` - stores `Index` instances -- `aim_geowave_metadata` - stores `Adapter` to `Index` mapping -- `adapter_geowave_metadata` - stores `Adapter` instances -- `sp_temp_dpt_idx_balanced_year_2147483647` - a table created for the index; all records that are indexed using this index would be placed into this table. -- `internal_adapter_geowave_metadata` - stores `Adapter Internal Adapter Mappings` within an Cassandra table for GeoWave metadata - -The conclusion: - -1. Index is unique and is created based on the input options by default. It has a table that is associated with this index (`sp_temp_dpt_idx_balanced_year_2147483647`). - -2. The default index name is generated based on the input index configuration. For example, `sp_temp_dpt_idx_balanced_year_2147483647` means a spatial temporal index with a per year binning and a max elevation = 2147483647). It is possible to override the default name with any custom unique string. - -3. Both Index and Adapter instances are serialized and stored in the DB. This is a design constraint from GeoWave which forces a single adapter and index per table. Once the index table is created it cannot be changed. - -4. An `Adapter` can be associated with more than one `Index`. `Adapter Name` refers to both an _adapter_ and all _indexes it can operate with_. - -5. Adapter and all the indices related to it are called `type` in GeoWave. - -6. All data ingested using different `adapters` but the _same_ `index` would be stored in the same table. - -Note that in the following sections of this document, `typeName` is the adapter name which references both the data type and all the indices related to it. - -The `sp_temp_dpt_idx_balanced_year_2147483647` table schema looks like this: - -``` -partition | adapter_id | data_id | .. other configurable index fields .. | value -``` - -Here `partition` means a Space Filling Curve (SFC) index, `adapter_id` means the adapter id, -`data_id` is the data identifier that is required to perform a secondary filtering in case -the SFC is not precise enough, and `value` is the actual value stored. - -### TypeName - -Each `DataTypeAdapter` instance is identified by its `TypeName`. -As seen above a type actually refers to combination of adapter, indices and their configuration. -The name used is purely an identifier and does not have any restrictions. - -### DataId - -`DataTypeAdapter` must be able to produce a data id as `Array[Byte]` for records it supports. -This data id must be unique per-type, per-table. -While writing records to cassandra with same id will produce additional rows they will be de-duplicated during query time. - -### Field Handlers - -In order to for your data type to be indexed there has to be a way to extract the position of the record with regard to the index dimensions, field handlers provide this functionality. -The matching happens by field name. Each extracted coordinate is stored in `CommonIndexModel` and need not be stored again as part of the field encoding if it is not useful. - -### PersistableRegistrySpi - -Each adapter and each handler must be registered with GeoWave `PersistableRegistrySpi`. -Failure to do so will result in various null pointer exceptions when reading or writing with that adapter. -All instances are persisted when first registered and are subsequently loaded from there each time a reader/writer is created. - - -## Index - -GeoWave [indices](https://locationtech.github.io/geowave/devguide.html#indices) provide the core mechanism to store and query multidimensional data. The index implementation is abstracted from `DataTypeAdapter` such that it is possible to use single implementation of an index with multiple data types. - -### DimensionalityTypeProviderSpi - -When creating a new index you should implement `DimensionalityTypeProviderSpi` interface. -This interface provides both the plugin discoverability for index as well as a way to configure it. -A range of functionality and configuration is provided. -Best way to dive into it is to inspect the `createIndex` method in existing implementations of this SPI. - -See: `SphericalIndexTypeProvider.scala` - -### NumericDimensionDefinition - -An index must provide a list of dimensions that it will range over. -For most "extra" dimensions `BasicDimensionDefinition` is sufficient. - -See: `ElevationDefinition.scala` - -### NumericDimensionField - -DimensionField is what provides the `IndexModel` with a way to read/write field values, it relies on `DimensionDefinition`. -Critically it is identified by its `fieldName`. The field name must match the field name of data type adapter field handler. -This is the core binding between implementations of `DataTypeAdapter` and `Index`. -The exact mechanism can be seen in the implementation of `GeoTrellisDataAdapter.encode`. - -See: `ElevationField.scala` - -### Name - -Index name must include enough information to avoid conflicts in its configuration. -Index configuration allows configuring things like dimension precision and value range. -These parameters effect the translation of dimension field values to their SFC encoded values. -Note that SFC values across different parameter values are not comparable. -In order to avid such conflicts the index name is used as the table name. - -### Options - -`DimensionalityTypeProviderSpi` is specified in conjunction with `CommonSpatialOptions`. -These serve double duty as command line option parser for GeoWave CLI, but are usable in other context. -Existing spatial and temporal indices have wealth of configurations that should be explored by the user. - -See: [CommonIndexOptions](https://github.com/locationtech/geowave/blob/v1.0.0/core/geotime/src/main/java/org/locationtech/geowave/core/geotime/ingest/CommonSpatialOptions.java) diff --git a/geowave/docs/schemas/delete-message.md b/geowave/docs/schemas/delete-message.md deleted file mode 100644 index 8d89f3d41c..0000000000 --- a/geowave/docs/schemas/delete-message.md +++ /dev/null @@ -1,203 +0,0 @@ -## The Root Schema Type - -`object` ([The Root Schema](delete-message.md)) - -# The Root Schema Properties - -| Property | Type | Required | Nullable | Defined by | -| :---------------------- | -------- | -------- | -------------- | :----------------------------------------------------------------------------------------------------------------------------- | -| [typeName](#typeName) | `string` | Required | cannot be null | [The Root Schema](delete-message-properties-the-typename-schema.md "\#/properties/typeName#/properties/typeName") | -| [indexName](#indexName) | `string` | Required | cannot be null | [The Root Schema](delete-message-properties-the-indexname-schema.md "\#/properties/indexName#/properties/indexName") | -| [geometry](#geometry) | `object` | Optional | can be null | [The Root Schema](delete-message-properties-the-geometry-schema.md "\#/properties/geometry#/properties/geometry") | -| [time](#time) | `object` | Optional | can be null | [The Root Schema](delete-message-properties-the-time-schema.md "\#/properties/time#/properties/time") | -| [elevation](#elevation) | `object` | Optional | can be null | [The Root Schema](delete-message-properties-the-elevation-schema.md "\#/properties/elevation#/properties/elevation") | -| [compareOp](#compareOp) | `string` | Optional | can be null | [The Root Schema](delete-message-properties-the-compareop-schema.md "\#/properties/compareOp#/properties/compareOp") | -| [namespace](#namespace) | `string` | Optional | can be null | [The Root Schema](delete-message-properties-storage-ie-cassandra-namespace.md "\#/properties/namespace#/properties/namespace") | - -## typeName - -A name that is used to identify DataType & IndexType it should be the same as it was configured in the IndexMessage - - -`typeName` - -- is required -- Type: `string` ([The typeName Schema](delete-message-properties-the-typename-schema.md)) -- cannot be null -- defined in: [The Root Schema](delete-message-properties-the-typename-schema.md "\#/properties/typeName#/properties/typeName") - -### typeName Type - -`string` ([The typeName Schema](delete-message-properties-the-typename-schema.md)) - -### typeName Constraints - -**pattern**: the string must match the following regular expression: - -```regexp -^(.*)$ -``` - -[try pattern](https://regexr.com/?expression=%5E(.*)%24 "try regular expression with regexr.com") - -### typeName Examples - -```json -"GeoTiffType" -``` - -## indexName - -An index name. Index name would be inferred from indexOptions and indexType by default during the IndexMessage process. - - -`indexName` - -- is required -- Type: `string` ([The indexName Schema](delete-message-properties-the-indexname-schema.md)) -- cannot be null -- defined in: [The Root Schema](delete-message-properties-the-indexname-schema.md "\#/properties/indexName#/properties/indexName") - -### indexName Type - -`string` ([The indexName Schema](delete-message-properties-the-indexname-schema.md)) - -## geometry - -GeoJSON of a Geometry (Point, Polygon, MultiPolygon, etc) type. - - -`geometry` - -- is optional -- Type: `object` ([The Geometry Schema](delete-message-properties-the-geometry-schema.md)) -- can be null -- defined in: [The Root Schema](delete-message-properties-the-geometry-schema.md "\#/properties/geometry#/properties/geometry") - -### geometry Type - -`object` ([The Geometry Schema](delete-message-properties-the-geometry-schema.md)) - -## time - -The time range definition in milliseconds with ISO strings. - - -`time` - -- is optional -- Type: `object` ([The Time Schema](delete-message-properties-the-time-schema.md)) -- can be null -- defined in: [The Root Schema](delete-message-properties-the-time-schema.md "\#/properties/time#/properties/time") - -### time Type - -`object` ([The Time Schema](delete-message-properties-the-time-schema.md)) - -## elevation - -The elevation range definition in ingested units. - - -`elevation` - -- is optional -- Type: `object` ([The elevation Schema](delete-message-properties-the-elevation-schema.md)) -- can be null -- defined in: [The Root Schema](delete-message-properties-the-elevation-schema.md "\#/properties/elevation#/properties/elevation") - -### elevation Type - -`object` ([The elevation Schema](delete-message-properties-the-elevation-schema.md)) - -## compareOp - -Type of query: intersection, inclusion, etc. - - -`compareOp` - -- is optional -- Type: `string` ([The Compareop Schema](delete-message-properties-the-compareop-schema.md)) -- can be null -- defined in: [The Root Schema](delete-message-properties-the-compareop-schema.md "\#/properties/compareOp#/properties/compareOp") - -### compareOp Type - -`string` ([The Compareop Schema](delete-message-properties-the-compareop-schema.md)) - -### compareOp Constraints - -**pattern**: the string must match the following regular expression: - -```regexp -^(.*)$ -``` - -[try pattern](https://regexr.com/?expression=%5E(.*)%24 "try regular expression with regexr.com") - -### compareOp Default Value - -The default value is: - -```json -"INTERSECTS" -``` - -### compareOp Examples - -```json -"CONTAINS" -``` - -```json -"OVERLAPS" -``` - -```json -"INTERSECTS" -``` - -```json -"TOUCHES" -``` - -```json -"WITHIN" -``` - -```json -"DISJOINT" -``` - -```json -"CROSSES" -``` - -```json -"EQUALS" -``` - -## namespace - -A namespace to refer during the connections establishment - - -`namespace` - -- is optional -- Type: `string` ([Storage (i.e. Cassandra) namespace](delete-message-properties-storage-ie-cassandra-namespace.md)) -- can be null -- defined in: [The Root Schema](delete-message-properties-storage-ie-cassandra-namespace.md "\#/properties/namespace#/properties/namespace") - -### namespace Type - -`string` ([Storage (i.e. Cassandra) namespace](delete-message-properties-storage-ie-cassandra-namespace.md)) - -### namespace Constraints - -**pattern**: the string must match the following regular expression: - -```regexp -^(.*)$ -``` diff --git a/geowave/docs/schemas/index-message.md b/geowave/docs/schemas/index-message.md deleted file mode 100644 index 1cc61c322c..0000000000 --- a/geowave/docs/schemas/index-message.md +++ /dev/null @@ -1,116 +0,0 @@ -## IndexMessage Type - -`object` ([IndexMessage](index-message.md)) - -# IndexMessage Properties - -| Property | Type | Required | Nullable | Defined by | -| :---------------------- | -------- | -------- | -------------- | :------------------------------------------------------------------------------------------------------------------------- | -| [indices](#indices) | `array` | Required | cannot be null | [IndexMessage](index-message-properties-the-indices-schema.md "\#/properties/indices#/properties/indices") | -| [typeName](#typeName) | `string` | Required | cannot be null | [IndexMessage](index-message-properties-the-typename-schema.md "\#/properties/typeName#/properties/typeName") | -| [dataType](#dataType) | `string` | Required | cannot be null | [IndexMessage](index-message-properties-the-datatype-schema.md "\#/properties/dataType#/properties/dataType") | -| [namespace](#namespace) | `string` | Optional | can be null | [IndexMessage](index-message-properties-storage-ie-cassandra-namespace.md "\#/properties/namespace#/properties/namespace") | - -## indices - - - - -`indices` - -- is required -- Type: `object[]` ([The Items Schema](index-message-properties-the-indices-schema-the-items-schema.md)) -- cannot be null -- defined in: [IndexMessage](index-message-properties-the-indices-schema.md "\#/properties/indices#/properties/indices") - -### indices Type - -`object[]` ([The Items Schema](index-message-properties-the-indices-schema-the-items-schema.md)) - -## typeName - -An arbitrary name that would be used to identify DataType & IndexType and will be used in the ingest message - - -`typeName` - -- is required -- Type: `string` ([The typeName Schema](index-message-properties-the-typename-schema.md)) -- cannot be null -- defined in: [IndexMessage](index-message-properties-the-typename-schema.md "\#/properties/typeName#/properties/typeName") - -### typeName Type - -`string` ([The typeName Schema](index-message-properties-the-typename-schema.md)) - -### typeName Constraints - -**pattern**: the string must match the following regular expression: - -```regexp -^(.*)$ -``` - -[try pattern](https://regexr.com/?expression=%5E(.*)%24 "try regular expression with regexr.com") - -### typeName Examples - -```json -"GeoTiffType" -``` - -## dataType - -A dataType this index would be used for - - -`dataType` - -- is required -- Type: `string` ([The dataType Schema](index-message-properties-the-datatype-schema.md)) -- cannot be null -- defined in: [IndexMessage](index-message-properties-the-datatype-schema.md "\#/properties/dataType#/properties/dataType") - -### dataType Type - -`string` ([The dataType Schema](index-message-properties-the-datatype-schema.md)) - -### dataType Constraints - -**pattern**: the string must match the following regular expression: - -```regexp -^(.*)$ -``` - -[try pattern](https://regexr.com/?expression=%5E(.*)%24 "try regular expression with regexr.com") - -### dataType Examples - -```json -"GEOTIFF" -``` - -## namespace - -A namespace to refer during the connections establishment - - -`namespace` - -- is optional -- Type: `string` ([Storage (i.e. Cassandra) namespace](index-message-properties-storage-ie-cassandra-namespace.md)) -- can be null -- defined in: [IndexMessage](index-message-properties-storage-ie-cassandra-namespace.md "\#/properties/namespace#/properties/namespace") - -### namespace Type - -`string` ([Storage (i.e. Cassandra) namespace](index-message-properties-storage-ie-cassandra-namespace.md)) - -### namespace Constraints - -**pattern**: the string must match the following regular expression: - -```regexp -^(.*)$ -``` diff --git a/geowave/docs/schemas/ingest-message.md b/geowave/docs/schemas/ingest-message.md deleted file mode 100644 index cd5d53393d..0000000000 --- a/geowave/docs/schemas/ingest-message.md +++ /dev/null @@ -1,149 +0,0 @@ -## IngestMessage Type - -`object` ([IngestMessage](ingest-message.md)) - -# IngestMessage Properties - -| Property | Type | Required | Nullable | Defined by | -| :---------------------- | -------- | -------- | -------------- | :--------------------------------------------------------------------------------------------------------------------------- | -| [typeName](#typeName) | `string` | Required | cannot be null | [IngestMessage](ingest-message-properties-the-typename-schema.md "\#/properties/typeName#/properties/typeName") | -| [dataType](#dataType) | `string` | Required | cannot be null | [IngestMessage](ingest-message-properties-the-datatype-schema.md "\#/properties/dataType#/properties/dataType") | -| [uri](#uri) | `string` | Required | cannot be null | [IngestMessage](ingest-message-properties-the-uri-schema.md "\#/properties/uri#/properties/uri") | -| [options](#options) | `object` | Optional | can be null | [IngestMessage](ingest-message-properties-the-ingest-options.md "\#/properties/options#/properties/options") | -| [namespace](#namespace) | `string` | Optional | can be null | [IngestMessage](ingest-message-properties-storage-ie-cassandra-namespace.md "\#/properties/namespace#/properties/namespace") | - -## typeName - -A name that is used to identify DataType & IndexType it should be the same as it was configured in the IndexMessage - - -`typeName` - -- is required -- Type: `string` ([The typeName Schema](ingest-message-properties-the-typename-schema.md)) -- cannot be null -- defined in: [IngestMessage](ingest-message-properties-the-typename-schema.md "\#/properties/typeName#/properties/typeName") - -### typeName Type - -`string` ([The typeName Schema](ingest-message-properties-the-typename-schema.md)) - -### typeName Constraints - -**pattern**: the string must match the following regular expression: - -```regexp -^(.*)$ -``` - -[try pattern](https://regexr.com/?expression=%5E(.*)%24 "try regular expression with regexr.com") - -### typeName Examples - -```json -"GeoTiffType" -``` - -## dataType - -A dataType the ingest would happen for - - -`dataType` - -- is required -- Type: `string` ([The dataType Schema](ingest-message-properties-the-datatype-schema.md)) -- cannot be null -- defined in: [IngestMessage](ingest-message-properties-the-datatype-schema.md "\#/properties/dataType#/properties/dataType") - -### dataType Type - -`string` ([The dataType Schema](ingest-message-properties-the-datatype-schema.md)) - -### dataType Constraints - -**pattern**: the string must match the following regular expression: - -```regexp -^(.*)$ -``` - -[try pattern](https://regexr.com/?expression=%5E(.*)%24 "try regular expression with regexr.com") - -### dataType Examples - -```json -"GEOTIFF" -``` - -## uri - -Path to a file - - -`uri` - -- is required -- Type: `string` ([The uri Schema](ingest-message-properties-the-uri-schema.md)) -- cannot be null -- defined in: [IngestMessage](ingest-message-properties-the-uri-schema.md "\#/properties/uri#/properties/uri") - -### uri Type - -`string` ([The uri Schema](ingest-message-properties-the-uri-schema.md)) - -### uri Constraints - -**pattern**: the string must match the following regular expression: - -```regexp -^(.*)$ -``` - -[try pattern](https://regexr.com/?expression=%5E(.*)%24 "try regular expression with regexr.com") - -### uri Examples - -```json -"file://path/to/file" -``` - -## options - -Data type specific options - - -`options` - -- is optional -- Type: `object` ([The Ingest Options](ingest-message-properties-the-ingest-options.md)) -- can be null -- defined in: [IngestMessage](ingest-message-properties-the-ingest-options.md "\#/properties/options#/properties/options") - -### options Type - -`object` ([The Ingest Options](ingest-message-properties-the-ingest-options.md)) - -## namespace - -A namespace to refer during the connections establishment - - -`namespace` - -- is optional -- Type: `string` ([Storage (i.e. Cassandra) namespace](ingest-message-properties-storage-ie-cassandra-namespace.md)) -- can be null -- defined in: [IngestMessage](ingest-message-properties-storage-ie-cassandra-namespace.md "\#/properties/namespace#/properties/namespace") - -### namespace Type - -`string` ([Storage (i.e. Cassandra) namespace](ingest-message-properties-storage-ie-cassandra-namespace.md)) - -### namespace Constraints - -**pattern**: the string must match the following regular expression: - -```regexp -^(.*)$ -``` diff --git a/geowave/src/main/resources/META-INF/services/geotrellis.geowave.adapter.GeoTrellisDataAdapterProvider b/geowave/src/main/resources/META-INF/services/geotrellis.geowave.adapter.GeoTrellisDataAdapterProvider deleted file mode 100644 index 3953a8f902..0000000000 --- a/geowave/src/main/resources/META-INF/services/geotrellis.geowave.adapter.GeoTrellisDataAdapterProvider +++ /dev/null @@ -1 +0,0 @@ -geotrellis.geowave.adapter.geotiff.GeoTiffAdapterProvider diff --git a/geowave/src/main/resources/META-INF/services/geotrellis.geowave.adapter.HandlersRegistryProvider b/geowave/src/main/resources/META-INF/services/geotrellis.geowave.adapter.HandlersRegistryProvider deleted file mode 100644 index c8cf826f46..0000000000 --- a/geowave/src/main/resources/META-INF/services/geotrellis.geowave.adapter.HandlersRegistryProvider +++ /dev/null @@ -1 +0,0 @@ -geotrellis.geowave.adapter.geotiff.GeoTiffHandlersRegistryProvider diff --git a/geowave/src/main/resources/META-INF/services/org.locationtech.geowave.core.index.persist.PersistableRegistrySpi b/geowave/src/main/resources/META-INF/services/org.locationtech.geowave.core.index.persist.PersistableRegistrySpi deleted file mode 100644 index 13ceecdf30..0000000000 --- a/geowave/src/main/resources/META-INF/services/org.locationtech.geowave.core.index.persist.PersistableRegistrySpi +++ /dev/null @@ -1 +0,0 @@ -geotrellis.geowave.GeoTrellisPersistableRegistry diff --git a/geowave/src/main/resources/META-INF/services/org.locationtech.geowave.core.store.spi.DimensionalityTypeProviderSpi b/geowave/src/main/resources/META-INF/services/org.locationtech.geowave.core.store.spi.DimensionalityTypeProviderSpi deleted file mode 100644 index 4aaf5c43e2..0000000000 --- a/geowave/src/main/resources/META-INF/services/org.locationtech.geowave.core.store.spi.DimensionalityTypeProviderSpi +++ /dev/null @@ -1 +0,0 @@ -geotrellis.geowave.index.SpatialTemporalElevationIndexTypeProvider diff --git a/geowave/src/main/resources/json/delete-message.schema.json b/geowave/src/main/resources/json/delete-message.schema.json deleted file mode 100644 index d7bb7cd743..0000000000 --- a/geowave/src/main/resources/json/delete-message.schema.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "definitions": {}, - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "delete-message.schema.json", - "type": "object", - "title": "The Root Schema", - "required": [ - "typeName", - "indexName" - ], - "properties": { - "typeName": { - "$id": "#/properties/typeName", - "type": "string", - "title": "The typeName Schema", - "description" : "A name that is used to identify DataType & IndexType it should be the same as it was configured in the IndexMessage", - "examples": [ - "GeoTiffType" - ], - "pattern": "^(.*)$" - }, - "indexName": { - "$id": "#/properties/indexName", - "type": "string", - "title": "The indexName Schema", - "description" : "An index name. Index name would be inferred from indexOptions and indexType by default during the IndexMessage process." - }, - "geometry": { - "$id": "#/properties/geometry", - "type": ["object", "null"], - "title": "The Geometry Schema", - "description" : "GeoJSON of a Geometry (Point, Polygon, MultiPolygon, etc) type.", - "required": [ - "type", - "coordinates" - ] - }, - "time": { - "$id": "#/properties/time", - "type": ["object", "null"], - "title": "The Time Schema", - "description" : "The time range definition in milliseconds with ISO strings.", - "required": [ - "min", - "max" - ], - "properties": { - "min": { - "$id": "#/properties/time/properties/min", - "type": "string", - "title": "The Min Schema" - }, - "max": { - "$id": "#/properties/time/properties/max", - "type": "string", - "title": "The Max Schema" - } - } - }, - "elevation": { - "$id": "#/properties/elevation", - "type": ["object", "null"], - "title": "The elevation Schema", - "description" : "The elevation range definition in ingested units.", - "required": [ - "min", - "max" - ], - "properties": { - "min": { - "$id": "#/properties/elevation/properties/min", - "type": "integer", - "title": "The Min Schema" - }, - "max": { - "$id": "#/properties/elevation/properties/max", - "type": "integer", - "title": "The Max Schema" - } - } - }, - "compareOp": { - "$id": "#/properties/compareOp", - "type": ["string", "null"], - "title": "The Compareop Schema", - "description" : "Type of query: intersection, inclusion, etc.", - "default": "INTERSECTS", - "examples": [ - "CONTAINS", - "OVERLAPS", - "INTERSECTS", - "TOUCHES", - "WITHIN", - "DISJOINT", - "CROSSES", - "EQUALS" - ], - "pattern": "^(.*)$" - }, - "namespace": { - "$id": "#/properties/namespace", - "type": ["string", "null"], - "title": "Storage (i.e. Cassandra) namespace", - "description" : "A namespace to refer during the connections establishment", - "pattern": "^(.*)$" - } - } -} diff --git a/geowave/src/main/resources/json/index-message.schema.json b/geowave/src/main/resources/json/index-message.schema.json deleted file mode 100644 index 3687834a63..0000000000 --- a/geowave/src/main/resources/json/index-message.schema.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "definitions": {}, - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "index-message.schema.json", - "type": "object", - "title": "IndexMessage", - "description" : "A description of the IndexMessage that is used to configure indices used in ingests.", - "required": [ - "indices", - "typeName", - "dataType" - ], - "properties": { - "indices": { - "$id": "#/properties/indices", - "type": "array", - "title": "The indices Schema", - "items": { - "$id": "#/properties/indices/items", - "type": "object", - "title": "The Items Schema", - "required": [ - "indexType", - "indexOptions" - ], - "properties": { - "indexName": { - "$id": "#/properties/indexName", - "type": ["string", "null"], - "title": "The indexName Schema", - "description" : "An index name. It is an optional name, index name would be inferred from indexOptions and indexType by default." - }, - "indexType": { - "$id": "#/properties/indexType", - "type": "string", - "title": "The indexType Schema", - "description" : "An index type", - "examples": [ - "spatial", - "spatial-temporal", - "spatial-temporal-depth" - ], - "pattern": "^(.*)$" - }, - "indexOptions": { - "$id": "#/properties/indexOptions", - "type": "object", - "title": "The indexOptions Schema", - "description" : "A dictionary with values that are dependent on the each IndexType." - } - } - } - }, - "typeName": { - "$id": "#/properties/typeName", - "type": "string", - "title": "The typeName Schema", - "description" : "An arbitrary name that would be used to identify DataType & IndexType and will be used in the ingest message", - "examples": [ - "GeoTiffType" - ], - "pattern": "^(.*)$" - }, - "dataType": { - "$id": "#/properties/dataType", - "type": "string", - "title": "The dataType Schema", - "description" : "A dataType this index would be used for", - "examples": [ - "GEOTIFF" - ], - "pattern": "^(.*)$" - }, - "namespace": { - "$id": "#/properties/namespace", - "type": ["string", "null"], - "title": "Storage (i.e. Cassandra) namespace", - "description" : "A namespace to refer during the connections establishment", - "pattern": "^(.*)$" - } - } -} \ No newline at end of file diff --git a/geowave/src/main/resources/json/ingest-message.schema.json b/geowave/src/main/resources/json/ingest-message.schema.json deleted file mode 100644 index 35bf7483f6..0000000000 --- a/geowave/src/main/resources/json/ingest-message.schema.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "definitions": {}, - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "ingest-message.schema.json", - "type": "object", - "title": "IngestMessage", - "description" : "A description of the IngestMessage that is used to configure the ingest.", - "required": [ - "typeName", - "dataType", - "uri" - ], - "properties": { - "typeName": { - "$id": "#/properties/typeName", - "type": "string", - "title": "The typeName Schema", - "description" : "A name that is used to identify DataType & IndexType it should be the same as it was configured in the IndexMessage", - "examples": [ - "GeoTiffType" - ], - "pattern": "^(.*)$" - }, - "dataType": { - "$id": "#/properties/dataType", - "type": "string", - "title": "The dataType Schema", - "description" : "A dataType the ingest would happen for", - "examples": [ - "GEOTIFF" - ], - "pattern": "^(.*)$" - }, - "uri": { - "$id": "#/properties/uri", - "type": "string", - "title": "The uri Schema", - "description": "Path to a file", - "examples": [ - "file://path/to/file" - ], - "pattern": "^(.*)$" - }, - "options": { - "$id": "#/properties/options", - "type": ["object", "null"], - "title": "The Ingest Options", - "description": "Data type specific options", - "properties": {}, - "additionalProperties": true - }, - "namespace": { - "$id": "#/properties/namespace", - "type": ["string", "null"], - "title": "Storage (i.e. Cassandra) namespace", - "description" : "A namespace to refer during the connections establishment", - "pattern": "^(.*)$" - } - }, - "additionalProperties": false -} \ No newline at end of file diff --git a/geowave/src/main/resources/json/message.schema.json b/geowave/src/main/resources/json/message.schema.json deleted file mode 100644 index 3802ad032c..0000000000 --- a/geowave/src/main/resources/json/message.schema.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "definitions": {}, - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "message.schema.json", - "type": "object", - "title": "Message", - "description" : "A description of the Message that is that is common", - "required": [ - "typeName", - "dataType" - ], - "properties": { - "typeName": { - "$id": "#/properties/typeName", - "type": "string", - "title": "The typeName Schema", - "description" : "An arbitrary name that would be used to identify DataType & IndexType and will be used in the ingest message", - "examples": [ - "GeoTiffType" - ], - "pattern": "^(.*)$" - }, - "dataType": { - "$id": "#/properties/dataType", - "type": "string", - "title": "The dataType Schema", - "description" : "A dataType this index would be used for", - "examples": [ - "GEOTIFF" - ], - "pattern": "^(.*)$" - }, - "namespace": { - "$id": "#/properties/namespace", - "type": ["string", "null"], - "title": "Storage (i.e. Cassandra) namespace", - "description" : "A namespace to refer during the connections establishment", - "pattern": "^(.*)$" - } - } -} \ No newline at end of file diff --git a/geowave/src/main/resources/reference.conf b/geowave/src/main/resources/reference.conf deleted file mode 100644 index e45286ef87..0000000000 --- a/geowave/src/main/resources/reference.conf +++ /dev/null @@ -1,12 +0,0 @@ -geotrellis.raster.gdal { - acceptable-datasets = ["SOURCE", "WARPED"] - number-of-attempts = 1048576 -} - -geotrellis.geowave.connection.store { - data-store-type = "cassandra" - options = { - "contactPoints": "localhost", - "gwNamespace" : "geotrellis" - } -} diff --git a/geowave/src/main/scala/geotrellis/geowave/GeoTrellisPersistableRegistry.scala b/geowave/src/main/scala/geotrellis/geowave/GeoTrellisPersistableRegistry.scala deleted file mode 100644 index 536b6d9aa7..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/GeoTrellisPersistableRegistry.scala +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave - -import geotrellis.geowave.adapter.geotiff.GeoTiffAdapter -import geotrellis.geowave.adapter.raster.MulitbandRasterAdapter -import geotrellis.geowave.index.dimension.{Elevation, ElevationDefinition} -import geotrellis.geowave.index.field.ElevationField -import org.locationtech.geowave.core.index.persist.PersistableRegistrySpi -import org.locationtech.geowave.core.index.persist.PersistableRegistrySpi.PersistableIdAndConstructor - -/** - * To be sure that we didn't forget to register classes it is possible to use the following test class from the GeoWave tests: - * https://github.com/locationtech/geowave/blob/v1.0.0/core/store/src/test/java/org/locationtech/geowave/core/store/TestStorePersistableRegistry.java - * - * GeoWave has a complete test example of creating custom index with custom dimensions. - */ -class GeoTrellisPersistableRegistry extends PersistableRegistrySpi { - protected val INITIAL_ID_HANDLERS: Short = 4000 - protected val INITIAL_ID_ADAPTERS: Short = 5000 - protected val INITIAL_ID_DIMENSIONS: Short = 6000 - protected val INITIAL_ID_FIELDS: Short = 7000 - protected val INITIAL_ID_DEFINITION: Short = 8000 - - def getSupportedPersistables: Array[PersistableRegistrySpi.PersistableIdAndConstructor] = - Array( - /** Handlers */ - new PersistableIdAndConstructor(INITIAL_ID_HANDLERS, () => new GeoTiffAdapter.GeometryHandler()), - new PersistableIdAndConstructor((INITIAL_ID_HANDLERS + 1).toShort, () => new MulitbandRasterAdapter.GeometryHandler()), - new PersistableIdAndConstructor((INITIAL_ID_HANDLERS + 2).toShort, () => new GeoTiffAdapter.TimestampHandler()), - new PersistableIdAndConstructor((INITIAL_ID_HANDLERS + 3).toShort, () => new GeoTiffAdapter.ElevationHandler()), - - /** Adapters */ - new PersistableIdAndConstructor(INITIAL_ID_ADAPTERS, () => new GeoTiffAdapter()), - new PersistableIdAndConstructor((INITIAL_ID_ADAPTERS + 1).toShort, () => new MulitbandRasterAdapter()), - - /** Index dimensions */ - new PersistableIdAndConstructor(INITIAL_ID_DIMENSIONS, () => new Elevation()), - - /** Index dimension fields */ - new PersistableIdAndConstructor(INITIAL_ID_FIELDS, () => new ElevationField()), - - /** Index dimension definition */ - new PersistableIdAndConstructor(INITIAL_ID_DEFINITION, () => new ElevationDefinition(0, 320000)) - ) -} diff --git a/geowave/src/main/scala/geotrellis/geowave/Implicits.scala b/geowave/src/main/scala/geotrellis/geowave/Implicits.scala deleted file mode 100644 index 0b2f157f38..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/Implicits.scala +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave - -import java.util.function.Supplier - -import geotrellis.proj4.CRS -import geotrellis.raster.{CellGrid, Dimensions, Raster, RasterExtent} -import geotrellis.util.MethodExtensions -import geotrellis.vector.Extent -import org.opengis.referencing.crs.CoordinateReferenceSystem -import spire.math._ -import spire.syntax.convertableFrom._ - -trait Implicits { - /** An implicit that converts object constructor into [[Supplier]] */ - implicit def supplier[T](f: () => T): Supplier[T] = { () => f() } - - /** Converts GeoTrellis [[CRS]] object to GeoTools [[CoordinateReferenceSystem]] */ - implicit def geotrellisCRSToGeoToolsCoordinateReferenceSystem(crs: CRS): CoordinateReferenceSystem = - crs.epsgCode match { - case Some(code) => org.geotools.referencing.CRS.decode(s"EPSG:${code}") - case _ => crs.toWKT() match { - case Some(wkt) => org.geotools.referencing.CRS.parseWKT(wkt) - case _ => throw new Exception("Can't convert GeoTrellis CRS into GeoTools CRS") - } - } - - /** Method extensions to normalize [[geotrellis.proj4.LatLng]] [[Extent]] */ - implicit class extentLatLngMethodExtensions(val self: Extent) extends MethodExtensions[Extent] { - // Y // [-90; +90] - private def clampLat(lat: Double): Double = if (lat < -90) -90 else if (lat > 90) 90 else lat - // X // [-180; +180] - private def clampLng(lng: Double): Double = if (lng < -180) -180 else if (lng > 180) 180 else lng - - // https://github.com/locationtech/proj4j/blob/v1.1.0/src/main/java/org/locationtech/proj4j/proj/Projection.java#L795-L803 - private def normalizeLng(lng: Double): Double = { - var angle = lng - while (angle > 180) angle -= 360 - while (angle < -180) angle += 360 - angle - } - - /** WARN: can be used only with [[geotrellis.proj4.LatLng]] only */ - def clampLatLng: Extent = { - Extent( - xmin = clampLng(self.xmin), - xmax = clampLng(self.xmax), - ymin = clampLat(self.ymin), - ymax = clampLat(self.ymax) - ) - } - - /** WARN: can be used only with [[geotrellis.proj4.LatLng]] only */ - def normalizeLatLng: Extent = { - val List(xmin, xmax) = List(normalizeLng(self.xmin), normalizeLng(self.xmax)).sorted - - Extent( - xmin = xmin, - xmax = xmax, - ymin = self.ymin, - ymax = self.ymax - ) - } - } - - /** Method extensions to normalize [[geotrellis.proj4.LatLng]] [[RasterExtent]] */ - implicit class rasterExtentLatLngMethodExtensions(val self: RasterExtent) extends MethodExtensions[RasterExtent] { - /** WARN: can be used only with [[geotrellis.proj4.LatLng]] only */ - def normalizeLatLng: RasterExtent = RasterExtent(self.extent.normalizeLatLng, self.cols, self.rows) - } - - /** Method extensions to normalize [[geotrellis.proj4.LatLng]] [[Extent]] */ - implicit class rasterLatLngMethodExtensions[T <: CellGrid[Int]](val self: Raster[T]) extends MethodExtensions[Raster[T]] { - /** WARN: can be used only with [[geotrellis.proj4.LatLng]] only */ - def normalizeLatLngExtent: Raster[T] = Raster(self.tile, self.extent.normalizeLatLng) - } -} - -object Implicits extends Implicits diff --git a/geowave/src/main/scala/geotrellis/geowave/adapter/AvroFieldReader.scala b/geowave/src/main/scala/geotrellis/geowave/adapter/AvroFieldReader.scala deleted file mode 100644 index be0bf4e6c2..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/adapter/AvroFieldReader.scala +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.adapter - -import geotrellis.store.avro._ -import org.locationtech.geowave.core.store.data.field.FieldReader - -/** GeoWave FieldReader subclass that uses GeoTrellis AvroRecordCodec to produce binary encoding */ -class AvroFieldReader[T: AvroRecordCodec] extends FieldReader[T] { - def readField(bytes: Array[Byte]): T = AvroEncoder.fromBinary[T](bytes) -} diff --git a/geowave/src/main/scala/geotrellis/geowave/adapter/AvroFieldWriter.scala b/geowave/src/main/scala/geotrellis/geowave/adapter/AvroFieldWriter.scala deleted file mode 100644 index e82ea162bc..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/adapter/AvroFieldWriter.scala +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.adapter - -import geotrellis.store.avro._ -import org.locationtech.geowave.core.store.data.field.FieldWriter - -/** GeoWave FieldWrter that uses GeoTrellis AvroRecordCodec to read values - * @note all fields are reported as visible - */ -class AvroFieldWriter[T: AvroRecordCodec] extends FieldWriter[T, T] { - override def getVisibility(rowValue: T, fieldName: String, fieldValue: T): Array[Byte] = Array() - def writeField(field: T): Array[Byte] = AvroEncoder.toBinary(field) -} diff --git a/geowave/src/main/scala/geotrellis/geowave/adapter/DataTypeRegistry.scala b/geowave/src/main/scala/geotrellis/geowave/adapter/DataTypeRegistry.scala deleted file mode 100644 index 24b51e5dbf..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/adapter/DataTypeRegistry.scala +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.adapter - -import java.util.ServiceLoader - -object DataTypeRegistry { - val supportedTypes: List[DataType] = { - import scala.collection.JavaConverters._ - - ServiceLoader - .load(classOf[GeoTrellisDataAdapterProvider]) - .iterator() - .asScala - .flatMap(_.supportedDataTypes) - .toList - } - - def exists(dataType: DataType): Boolean = supportedTypes.contains(dataType) - def find(dataType: String): Option[DataType] = supportedTypes.find(_ == dataType) -} diff --git a/geowave/src/main/scala/geotrellis/geowave/adapter/ElevationFieldHandler.scala b/geowave/src/main/scala/geotrellis/geowave/adapter/ElevationFieldHandler.scala deleted file mode 100644 index 644d964c47..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/adapter/ElevationFieldHandler.scala +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.adapter - -import geotrellis.geowave.dsl.syntax._ -import geotrellis.geowave.index.dimension.Elevation - -trait ElevationFieldHandler[T] extends IndexFieldHandler[T] { - protected var fieldName: IndexFieldName = Elevation.DEFAULT_FIELD_NAME.indexFieldName -} diff --git a/geowave/src/main/scala/geotrellis/geowave/adapter/GeoTrellisDataAdapter.scala b/geowave/src/main/scala/geotrellis/geowave/adapter/GeoTrellisDataAdapter.scala deleted file mode 100644 index bd72b4541d..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/adapter/GeoTrellisDataAdapter.scala +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.adapter - -import java.nio.ByteBuffer -import java.util -import java.util.ServiceLoader - -import cats.data.Validated -import geotrellis.geowave.dsl.syntax._ -import org.locationtech.geowave.core.index.persist.{Persistable, PersistenceUtils} -import org.locationtech.geowave.core.index.{ByteArrayUtils, StringUtils, VarintUtils} -import org.locationtech.geowave.core.store.adapter.{AdapterPersistenceEncoding, IndexedAdapterPersistenceEncoding} -import org.locationtech.geowave.core.store.api.{DataTypeAdapter, Index} -import org.locationtech.geowave.core.store.data.MultiFieldPersistentDataset -import org.locationtech.geowave.core.store.data.field.{FieldReader, FieldWriter} -import org.locationtech.geowave.core.store.index.{CommonIndexModel, CommonIndexValue} -import org.slf4j.LoggerFactory - -import scala.collection.JavaConverters._ - -/** GeoTrellisDataAdapter abstracts over storing raster data indexed using GeoWave index. - * - * DataAdapter instances specifies: - * - How to extract index values from the input entry - * - How to read and write the entry for a GeoWave table - * - How the data will be stored in native (Cassandra) fields - * - What indexes are to be used when storing the data - * - * Each Adapter has a name, that should be unique per Cassandra namespace. - * Adapter may have a one-to-many relationship with indexes. - * - Relationships are persisted in `aim_geowave_metadata` table. - * - * DataApter and Index instances are associated together through GeoWave DataStore. - * - * {{{ - * val dataStore: DataStore = ??? - * // call to addType persists the adapter, index instances and their and relationships - * dataStore.addType(adapter, index1, index2) - * val writer = dataStore.createWriter[GeoTiff[MultibandTile]](adapter.getTypeName) - * writer.write(entry) - * }}} - * - * This will result with each entry being written to multiple tables each associated with a given index. - * - * In order to support this persistance mechanism each adapter must be registered with the adapter SPI in - * [[geotrellis.geowave.GeoTrellisPersistableRegistry]]. - * - * @note All adapters should have an empty constructor to use Serialization mechanisms. - * - * @note Adapter needs to be registered with the store only once. - * Once the adapter is used to write a record once, it is presisted to the store. - * All further reads and writes will read that adapter from the store. - * - * @see https://locationtech.github.io/geowave/devguide.html#adapters - */ -abstract class GeoTrellisDataAdapter[T <: AnyRef]( - /** The type name which serves as a unique identifier for this adapter. This also must be unique within a datastore. */ - private var typeName: TypeName, - private var fieldHandlers: List[IndexFieldHandler[T]] -) extends DataTypeAdapter[T] { - protected val logger = LoggerFactory.getLogger(this.getClass()) - protected val DATA_FIELD_ID: String - - /** - * Copied from the RasterDataAdapter, we can make it configurable though - * For SimpleFeatures it is a FeatureId, for odel this can be a ModelId - */ - override def getDataId(entry: T): Array[Byte] - - /** Gets a reader to read the value from the row */ - def getReader(fieldName: String): FieldReader[AnyRef] - - /** Gets a writer to write the value into the row */ - def getWriter(fieldName: String): FieldWriter[T, AnyRef] - - - // these are lazy because of initilization order - lazy val fieldNames = fieldHandlers.map(_.getFieldName) :+ DATA_FIELD_ID - lazy val fieldNameMatchingFieldHandlers = fieldHandlers.map { handler => - handler.getFieldName -> handler - }.toMap[String, IndexFieldHandler[T]] - lazy val fieldNameToIndex = fieldNames.zipWithIndex.toMap - lazy val indexToFieldName = fieldNameToIndex.map { case (k, v) => (v, k) } - - override def getTypeName: String = { - logger.trace(s"getTypeName: ${typeName}") - typeName - } - - /** - * Field handlers helpers. - * Helper is a function that knows how to extract index value from the entry. - */ - def getFieldHandlers = { - logger.trace(s"getFieldHandlers: $fieldHandlers") - fieldHandlers - } - - /** - * Validates that this adapter can provide the index with all fields required by its dimensions - */ - def validateIndexCompatability(index: Index): Validated[String, Index] = { - val availableFields = fieldHandlers.map(_.getFieldName.value).toSet - val requiredFields = index.getIndexModel.getDimensions.map(_.getFieldName).toSet - val missingFields = requiredFields.diff(availableFields) - - if (missingFields.isEmpty) Validated.valid(index) - else Validated.invalid(s"${index.getName} index requires ${missingFields} fields, ${availableFields} are available") - } - - def getFieldHandler(name: String): Option[IndexFieldHandler[T]] = { - logger.trace(s"getFieldHandler: ${name}") - fieldNameMatchingFieldHandlers.get(name) - } - - /** The position in a row is indexed, by the field name we can get the offset of the recorded field in a row */ - def getPositionOfOrderedField(commonIndexModel: CommonIndexModel, fieldName: String): Int = { - logger.trace(s"getPositionofOrderedField($fieldName)") - fieldNameToIndex(fieldName) - } - - /** The position in a row is indexed, by the field offset we can get the name of the recorded field in a row */ - def getFieldNameForPosition(commonIndexModel: CommonIndexModel, index: Int): String = { - logger.trace(s"getFieldNameForPosition($index)") - indexToFieldName(index) - } - - /** There is no need in using a handlers mechanism, since this is the only "DATA" field. */ - override def decode(data: IndexedAdapterPersistenceEncoding, index: Index): T = { - logger.trace(s"decode($index)") - data.getAdapterExtendedData.getValue(DATA_FIELD_ID).asInstanceOf[T] - } - - override def encode(entry: T, indexModel: CommonIndexModel): AdapterPersistenceEncoding = { - logger.trace(s"encode($entry)") - /** Each handler is a function that knows how to extract value from the entry that would be used to build index */ - val indexData = new MultiFieldPersistentDataset[CommonIndexValue]() - indexModel.getDimensions.foreach { dimension => - getFieldHandler(dimension.getFieldName).map { handler => - val value = handler.toIndexValue(entry) - indexData.addValue(dimension.getFieldName, value) - } - } - - /** Since we have a single value field, there are no needs in using handlers mechanisms to extract data from the entry */ - val extendedData = new MultiFieldPersistentDataset[AnyRef]() - extendedData.addValue(DATA_FIELD_ID, entry) - - new AdapterPersistenceEncoding(getDataId(entry), indexData, extendedData) - } - - /** - * Serializes adapter since it stores it in the table and uses this data on read - * to construct the adapter from the persisted parameters. - */ - def toBinary: Array[Byte] = { - val persistables = new util.LinkedHashSet[Persistable]() - fieldHandlers.map { indexHandler => persistables.add(indexHandler.asInstanceOf[Persistable]) } - - val typeNameBytes = StringUtils.stringToBinary(typeName) - val persistablesBytes = PersistenceUtils.toBinary(persistables) - - val buf = - ByteBuffer.allocate( - typeNameBytes.length - + persistablesBytes.length - + VarintUtils.unsignedIntByteLength(typeNameBytes.length) - + VarintUtils.unsignedIntByteLength(persistablesBytes.length)) - - VarintUtils.writeUnsignedInt(typeNameBytes.length, buf) - VarintUtils.writeUnsignedInt(persistablesBytes.length, buf) - - buf.put(typeNameBytes) - buf.put(persistablesBytes) - logger.trace(s"toBinary $this: ${buf.position} bytes") - buf.array - } - - def fromBinary(bytes: Array[Byte]): Unit = { - logger.trace(s"fromBinary: ${bytes.length} bytes") - val buf = ByteBuffer.wrap(bytes) - - val typeNameBytesLength = VarintUtils.readUnsignedInt(buf) - val persistablesBytesLength = VarintUtils.readUnsignedInt(buf) - - val typeName = StringUtils.stringFromBinary(ByteArrayUtils.safeRead(buf, typeNameBytesLength)) - val persistables = PersistenceUtils.fromBinaryAsList(ByteArrayUtils.safeRead(buf, persistablesBytesLength)).asScala.toList - - this.typeName = typeName.typeName - fieldHandlers = persistables.map(_.asInstanceOf[IndexFieldHandler[T]]) - } -} - -object GeoTrellisDataAdapter { - def load(dataType: DataType, typeName: TypeName): GeoTrellisDataAdapter[_] = { - import scala.collection.JavaConverters._ - - ServiceLoader - .load(classOf[GeoTrellisDataAdapterProvider]) - .iterator() - .asScala - .find(_.canProcess(dataType)) - .getOrElse(throw new RuntimeException(s"Unable to find DataAdapter for type $dataType")) - .adapter(typeName) - } -} diff --git a/geowave/src/main/scala/geotrellis/geowave/adapter/GeoTrellisDataAdapterProvider.scala b/geowave/src/main/scala/geotrellis/geowave/adapter/GeoTrellisDataAdapterProvider.scala deleted file mode 100644 index 2c72781f03..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/adapter/GeoTrellisDataAdapterProvider.scala +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.adapter - - -trait GeoTrellisDataAdapterProvider { - def supportedDataTypes: List[DataType] - def canProcess(dataType: DataType): Boolean = supportedDataTypes.contains(dataType) - def adapter(typeName: TypeName): GeoTrellisDataAdapter[_] -} diff --git a/geowave/src/main/scala/geotrellis/geowave/adapter/GeometryFieldHandler.scala b/geowave/src/main/scala/geotrellis/geowave/adapter/GeometryFieldHandler.scala deleted file mode 100644 index a88d072598..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/adapter/GeometryFieldHandler.scala +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.adapter - -import geotrellis.geowave.dsl.syntax._ -import org.locationtech.geowave.core.geotime.store.dimension.GeometryWrapper - -trait GeometryFieldHandler[T] extends IndexFieldHandler[T] { - protected var fieldName: IndexFieldName = GeometryWrapper.DEFAULT_GEOMETRY_FIELD_NAME.indexFieldName -} diff --git a/geowave/src/main/scala/geotrellis/geowave/adapter/IndexFieldHandler.scala b/geowave/src/main/scala/geotrellis/geowave/adapter/IndexFieldHandler.scala deleted file mode 100644 index 69e360c2dc..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/adapter/IndexFieldHandler.scala +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.adapter - -import geotrellis.geowave.dsl.syntax._ -import org.locationtech.geowave.core.index.StringUtils -import org.locationtech.geowave.core.index.persist.Persistable -import org.locationtech.geowave.core.store.index.CommonIndexValue - -/** This class is used by the DataAdapter to translate between native values and persistence - * encoded values. The basic implementation of this will perform type matching on the index field type. - * - * The field name is mutable so it can be made to match field names required by a given index. - */ -trait IndexFieldHandler[RowType] extends Persistable { - protected var fieldName: IndexFieldName - - def getFieldName: IndexFieldName = fieldName - - def setFieldName(name: IndexFieldName): Unit = this.fieldName = name - - def toIndexValue(row: RowType): CommonIndexValue - - override def toBinary: Array[Byte] = { - StringUtils.stringToBinary(fieldName) - } - - override def fromBinary(bytes: Array[Byte]): Unit = { - fieldName = StringUtils.stringFromBinary(bytes).indexFieldName - } -} diff --git a/geowave/src/main/scala/geotrellis/geowave/adapter/TimestampFieldHandler.scala b/geowave/src/main/scala/geotrellis/geowave/adapter/TimestampFieldHandler.scala deleted file mode 100644 index 8a9bf8b76d..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/adapter/TimestampFieldHandler.scala +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.adapter - -import geotrellis.geowave.dsl.syntax._ - -trait TimestampFieldHandler[T] extends IndexFieldHandler[T] { - /** @see org.locationtech.geowave.core.geotime.store.dimensio.TimeField */ - protected var fieldName: IndexFieldName = "default_time_dimension".indexFieldName -} diff --git a/geowave/src/main/scala/geotrellis/geowave/adapter/geotiff/GeoTiffAdapter.scala b/geowave/src/main/scala/geotrellis/geowave/adapter/geotiff/GeoTiffAdapter.scala deleted file mode 100644 index 2628d0cfec..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/adapter/geotiff/GeoTiffAdapter.scala +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.adapter.geotiff - -import java.time.{ZoneOffset, ZonedDateTime} -import java.time.format.DateTimeFormatter - -import geotrellis.geowave.GeoTrellisPersistableRegistry -import geotrellis.geowave.adapter._ -import geotrellis.geowave.dsl.syntax._ -import geotrellis.geowave.index.dimension.Elevation -import geotrellis.raster.MultibandTile -import geotrellis.raster.io.geotiff.GeoTiff -import org.locationtech.geowave.core.geotime.store.dimension.{GeometryWrapper, Time} -import org.locationtech.geowave.core.store.data.field.{FieldReader, FieldWriter} - -/** - * All adapters should have an empty constructor to use Serialization mechanisms. - * Each new Adapter should also be registered in the [[GeoTrellisPersistableRegistry]]. - */ -class GeoTiffAdapter( - private var typeName: TypeName = "".typeName, - private var fieldHandlers: List[IndexFieldHandler[GeoTiff[MultibandTile]]] = List( - new GeoTiffAdapter.GeometryHandler, - new GeoTiffAdapter.TimestampHandler, - new GeoTiffAdapter.ElevationHandler) -) extends GeoTrellisDataAdapter[GeoTiff[MultibandTile]](typeName, fieldHandlers) { - protected val DATA_FIELD_ID = "GT_TIFF" - - /** - * For SimpleFeatures it is a FeatureId, for model this can be a ModelId, smth to help filter the results - * In case the partitionKey would mach across several entries due to SFC limitations - */ - def getDataId(t: GeoTiff[MultibandTile]): Array[Byte] = Array(0) - - /** Gets a reader to read the value from the row */ - def getReader(fieldName: String): FieldReader[AnyRef] = - if(fieldName == DATA_FIELD_ID) new GeoTiffFieldReader() else null - - /** Gets a writer to write the value into the row */ - def getWriter(fieldName: String): FieldWriter[GeoTiff[MultibandTile], AnyRef] = - new GeoTiffFieldWriter() -} - -object GeoTiffAdapter { - - /** A function that extracts [[geotrellis.vector.Extent]] from the [[GeoTiff[MultibandTile]]] */ - class GeometryHandler extends GeometryFieldHandler[GeoTiff[MultibandTile]] { - def toIndexValue(tiff: GeoTiff[MultibandTile]): GeometryWrapper = - new GeometryWrapper(tiff.extent.toPolygon(), Array()) - } - - - /** A function that extracts [[Elevation]] from the [[GeoTiff[MultibandTile]]] */ - class ElevationHandler extends ElevationFieldHandler[GeoTiff[MultibandTile]] { - def toIndexValue(tiff: GeoTiff[MultibandTile]): Elevation = - Elevation(java.lang.Double.parseDouble(tiff.tags.headTags("ELEVATION"))) - } - - - /** A function that extracts [[Time]] from the [[GeoTiff[MultibandTile]]] */ - class TimestampHandler extends TimestampFieldHandler[GeoTiff[MultibandTile]] { - def toIndexValue(tiff: GeoTiff[MultibandTile]): Time = { - val dateString = tiff.tags.headTags(GEOTIFF_TIME_TAG_DEFAULT) - val dateTime = ZonedDateTime.from(GEOTIFF_TIME_FORMATTER_DEFAULT.parse(dateString)) - new Time.Timestamp(dateTime.toInstant.toEpochMilli, Array()) - } - } - - /** Corresponds to Time.DEFAULT_FIELD_ID */ - val GEOTIFF_TIME_TAG_DEFAULT = "TIFFTAG_DATETIME" - val GEOTIFF_TIME_FORMAT_DEFAULT = "yyyy:MM:dd HH:mm:ss" - val GEOTIFF_TIME_FORMAT = "GEOTIFF_TIME_FORMAT" - val GEOTIFF_TIME_FORMATTER_DEFAULT = timeFormatter(GEOTIFF_TIME_FORMAT_DEFAULT) - - def timeFormatter(pattern: String): DateTimeFormatter = DateTimeFormatter.ofPattern(pattern).withZone(ZoneOffset.UTC) -} diff --git a/geowave/src/main/scala/geotrellis/geowave/adapter/geotiff/GeoTiffAdapterProvider.scala b/geowave/src/main/scala/geotrellis/geowave/adapter/geotiff/GeoTiffAdapterProvider.scala deleted file mode 100644 index 02ae77c826..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/adapter/geotiff/GeoTiffAdapterProvider.scala +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.adapter.geotiff - -import geotrellis.geowave.adapter._ - -class GeoTiffAdapterProvider extends GeoTrellisDataAdapterProvider { - def supportedDataTypes: List[DataType] = List(DataTypeGeoTiff) - def adapter(typeName: TypeName): GeoTrellisDataAdapter[_] = - new GeoTiffAdapter(typeName) -} diff --git a/geowave/src/main/scala/geotrellis/geowave/adapter/geotiff/GeoTiffFieldReader.scala b/geowave/src/main/scala/geotrellis/geowave/adapter/geotiff/GeoTiffFieldReader.scala deleted file mode 100644 index b4b044ffbc..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/adapter/geotiff/GeoTiffFieldReader.scala +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.adapter.geotiff - -import geotrellis.raster.MultibandTile -import geotrellis.raster.io.geotiff.GeoTiff -import geotrellis.raster.io.geotiff.reader.GeoTiffReader -import org.locationtech.geowave.core.store.data.field.FieldReader - -class GeoTiffFieldReader extends FieldReader[GeoTiff[MultibandTile]] { - def readField(bytes: Array[Byte]): GeoTiff[MultibandTile] = GeoTiffReader.readMultiband(bytes) -} diff --git a/geowave/src/main/scala/geotrellis/geowave/adapter/geotiff/GeoTiffFieldWriter.scala b/geowave/src/main/scala/geotrellis/geowave/adapter/geotiff/GeoTiffFieldWriter.scala deleted file mode 100644 index 2f7bcc92f3..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/adapter/geotiff/GeoTiffFieldWriter.scala +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.adapter.geotiff - -import geotrellis.raster.MultibandTile -import geotrellis.raster.io.geotiff.GeoTiff -import org.locationtech.geowave.core.store.data.field.FieldWriter - -class GeoTiffFieldWriter extends FieldWriter[GeoTiff[MultibandTile], GeoTiff[MultibandTile]] { - override def getVisibility(rowValue: GeoTiff[MultibandTile], fieldName: String, fieldValue: GeoTiff[MultibandTile]): Array[Byte] = Array() - def writeField(field: GeoTiff[MultibandTile]): Array[Byte] = field.toByteArray -} diff --git a/geowave/src/main/scala/geotrellis/geowave/adapter/geotiff/package.scala b/geowave/src/main/scala/geotrellis/geowave/adapter/geotiff/package.scala deleted file mode 100644 index 864ea1703b..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/adapter/geotiff/package.scala +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.adapter - -import geotrellis.geowave.dsl.syntax._ - -package object geotiff { - val DataTypeGeoTiff = "GeoTiff".dataType -} diff --git a/geowave/src/main/scala/geotrellis/geowave/adapter/package.scala b/geowave/src/main/scala/geotrellis/geowave/adapter/package.scala deleted file mode 100644 index b4659d63ff..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/adapter/package.scala +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave - -import io.estatico.newtype.macros.newsubtype -import org.locationtech.geowave.core.store.data.field.{FieldReader, FieldWriter} - -package object adapter { - - /** Input data type that can be used to find a [[GeoTrellisDataAdapter]] instance. - * DataType describes both the format and semantics of the data - * - * DataType describes how to get the reader for the data we need to ingest. - * It does not describe how it will be stored and indexed, that is controled by the DataAdapter. - */ - @newsubtype case class DataType(value: String) - - /** Name for [[GeoTrellisDataAdapter]] instance. - * - This name is provided during index configuration - * - This name must be given when ingesting a file - */ - @newsubtype case class TypeName(value: String) - - /** Name of a field on which a feature is indexed. - * - * List of field names per DataType are defined by which [[NamedIndexFieldHandler]]s are provided to [[GeoTrellisDataAdapter]]. - * Thus this name only has any meaning in relation to specific [[GeoTrellisDataAdapter]] instance. - * Index field values are stored in Common Index Data and are used for query refinement. - */ - @newsubtype case class IndexFieldName(value: String) - - implicit def upcastFieldReader[T](fieldReader: FieldReader[T]): FieldReader[AnyRef] = fieldReader.asInstanceOf[FieldReader[AnyRef]] - implicit def upcastFieldWriter[T](fieldWriter: FieldWriter[T, T]): FieldWriter[T, AnyRef] = fieldWriter.asInstanceOf[FieldWriter[T, AnyRef]] -} diff --git a/geowave/src/main/scala/geotrellis/geowave/adapter/raster/MulitbandRasterAdapter.scala b/geowave/src/main/scala/geotrellis/geowave/adapter/raster/MulitbandRasterAdapter.scala deleted file mode 100644 index 555df7ebc4..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/adapter/raster/MulitbandRasterAdapter.scala +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.adapter.raster - -import geotrellis.geowave.GeoTrellisPersistableRegistry -import geotrellis.geowave.adapter._ -import geotrellis.geowave.dsl.syntax._ -import geotrellis.raster.{MultibandTile, Raster} -import org.locationtech.geowave.core.geotime.store.dimension.GeometryWrapper -import org.locationtech.geowave.core.store.data.field.{FieldReader, FieldWriter} - -/** - * All adapters should have an empty constructor to use Serialization mechanisms. - * Each new Adapter should also be registered in the [[GeoTrellisPersistableRegistry]]. - */ -class MulitbandRasterAdapter( - private var typeName: TypeName = "".typeName, - private var fieldHandlers: List[IndexFieldHandler[Raster[MultibandTile]]] = List( - new MulitbandRasterAdapter.GeometryHandler - ) -) extends GeoTrellisDataAdapter[Raster[MultibandTile]](typeName, fieldHandlers) { - protected val DATA_FIELD_ID = "GT_RASTER" - - /** - * For SimpleFeatures it is a FeatureId, for model this can be a ModelId, smth to help filter the results - * In case the partitionKey would mach across several entries due to SFC limitations - */ - def getDataId(t: Raster[MultibandTile]): Array[Byte] = Array(0) - - /** Gets a reader to read the value from the row */ - def getReader(fieldName: String): FieldReader[AnyRef] = if(fieldName == DATA_FIELD_ID) new MultibandRasterReader() else null - - /** Gets a writer to write the value into the row */ - def getWriter(fieldName: String): FieldWriter[Raster[MultibandTile], AnyRef] = new MultibandRasterWriter() -} - -object MulitbandRasterAdapter { - /** A function that extracts [[geotrellis.vector.Extent]] from the [[Raster[MultibandTile]]] */ - class GeometryHandler extends GeometryFieldHandler[Raster[MultibandTile]] { - def toIndexValue(raster: Raster[MultibandTile]): GeometryWrapper = - new GeometryWrapper(raster.extent.toPolygon(), Array()) - } -} diff --git a/geowave/src/main/scala/geotrellis/geowave/adapter/raster/MultibandRasterReader.scala b/geowave/src/main/scala/geotrellis/geowave/adapter/raster/MultibandRasterReader.scala deleted file mode 100644 index bf4f574f25..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/adapter/raster/MultibandRasterReader.scala +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.adapter.raster - -import geotrellis.geowave.adapter.raster.avro._ -import geotrellis.raster.{MultibandTile, Raster} -import geotrellis.store.avro.AvroEncoder -import org.locationtech.geowave.core.store.data.field.FieldReader - -class MultibandRasterReader extends FieldReader[Raster[MultibandTile]] { - def readField(bytes: Array[Byte]): Raster[MultibandTile] = AvroEncoder.fromBinary[Raster[MultibandTile]](bytes) -} - diff --git a/geowave/src/main/scala/geotrellis/geowave/adapter/raster/MultibandRasterWriter.scala b/geowave/src/main/scala/geotrellis/geowave/adapter/raster/MultibandRasterWriter.scala deleted file mode 100644 index b272372d7c..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/adapter/raster/MultibandRasterWriter.scala +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.adapter.raster - -import geotrellis.geowave.adapter.raster.avro._ -import geotrellis.raster.{MultibandTile, Raster} -import geotrellis.store.avro._ -import org.locationtech.geowave.core.store.data.field.FieldWriter - -class MultibandRasterWriter extends FieldWriter[Raster[MultibandTile], Raster[MultibandTile]] { - override def getVisibility(rowValue: Raster[MultibandTile], fieldName: String, fieldValue: Raster[MultibandTile]): Array[Byte] = Array() - def writeField(field: Raster[MultibandTile]): Array[Byte] = AvroEncoder.toBinary(field.mapTile(_.toArrayTile(): MultibandTile)) -} diff --git a/geowave/src/main/scala/geotrellis/geowave/adapter/raster/avro/Implicits.scala b/geowave/src/main/scala/geotrellis/geowave/adapter/raster/avro/Implicits.scala deleted file mode 100644 index 0fb8ec8627..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/adapter/raster/avro/Implicits.scala +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.adapter.raster.avro - -trait Implicits extends RasterCodec - -object Implicits extends Implicits diff --git a/geowave/src/main/scala/geotrellis/geowave/adapter/raster/avro/RasterCodec.scala b/geowave/src/main/scala/geotrellis/geowave/adapter/raster/avro/RasterCodec.scala deleted file mode 100644 index e4abe4147b..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/adapter/raster/avro/RasterCodec.scala +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.adapter.raster.avro - -import geotrellis.raster.{CellGrid, Raster} -import geotrellis.store.avro._ -import geotrellis.vector.Extent - -import org.apache.avro.SchemaBuilder -import org.apache.avro.generic.GenericRecord - -trait RasterCodec { - implicit def rasterCodec[T <: CellGrid[Int]: AvroRecordCodec]: AvroRecordCodec[Raster[T]] = new AvroRecordCodec[Raster[T]] { - def schema = SchemaBuilder - .record("Raster").namespace("geotrellis.raster") - .fields() - .name("tile").`type`(AvroRecordCodec[T].schema).noDefault - .name("extent").`type`(AvroRecordCodec[Extent].schema).noDefault - .endRecord() - - def encode(raster: Raster[T], rec: GenericRecord): Unit = { - rec.put("tile", AvroRecordCodec[T].encode(raster.tile)) - rec.put("extent", AvroRecordCodec[Extent].encode(raster.extent)) - } - - def decode(rec: GenericRecord): Raster[T] = { - val tile = AvroRecordCodec[T].decode(rec[GenericRecord]("tile")) - val extent = AvroRecordCodec[Extent].decode(rec[GenericRecord]("extent")) - Raster(tile, extent) - } - } - -} diff --git a/geowave/src/main/scala/geotrellis/geowave/adapter/raster/avro/package.scala b/geowave/src/main/scala/geotrellis/geowave/adapter/raster/avro/package.scala deleted file mode 100644 index 889f5fd9e5..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/adapter/raster/avro/package.scala +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.adapter.raster - -package object avro extends Implicits diff --git a/geowave/src/main/scala/geotrellis/geowave/api/SQueryBuilder.scala b/geowave/src/main/scala/geotrellis/geowave/api/SQueryBuilder.scala deleted file mode 100644 index bc66ce7ffe..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/api/SQueryBuilder.scala +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.api - -import org.locationtech.geowave.core.store.api.QueryBuilder - -object SQueryBuilder { - def newBuilder[T]: SQueryBuilder[T] = QueryBuilder.newBuilder[T]().asInstanceOf[SQueryBuilder[T]] -} diff --git a/geowave/src/main/scala/geotrellis/geowave/api/package.scala b/geowave/src/main/scala/geotrellis/geowave/api/package.scala deleted file mode 100644 index a25b06c986..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/api/package.scala +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave - -import cats.Semigroup -import org.locationtech.geowave.core.store.api.QueryBuilder -import org.locationtech.geowave.core.store.query.constraints.BasicQueryByClass.ConstraintsByClass - -package object api { - type SQueryBuilder[T] = QueryBuilder[T, R] forSome { type R <: QueryBuilder[T, R] } - - implicit val constraintsByClassSemigroup: Semigroup[ConstraintsByClass] = { _ merge _ } -} diff --git a/geowave/src/main/scala/geotrellis/geowave/conf/Implicits.scala b/geowave/src/main/scala/geotrellis/geowave/conf/Implicits.scala deleted file mode 100644 index 0415d787cd..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/conf/Implicits.scala +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.conf - -import io.estatico.newtype.Coercible -import pureconfig.ConfigReader - -trait Implicits { - /** Derive pureconfig codecs for newtypes. */ - implicit def coercibleConfigReader[R, N](implicit ev: Coercible[ConfigReader[R], ConfigReader[N]], R: ConfigReader[R]): ConfigReader[N] = ev(R) -} - -object Implicits extends Implicits diff --git a/geowave/src/main/scala/geotrellis/geowave/conf/StoreConfiguration.scala b/geowave/src/main/scala/geotrellis/geowave/conf/StoreConfiguration.scala deleted file mode 100644 index f53f976d1f..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/conf/StoreConfiguration.scala +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.conf - -import cats.effect.Sync -import cats.syntax.option._ -import geotrellis.geowave.dsl.DataStoreType -import org.locationtech.geowave.core.store.api.DataStore -import pureconfig._ -import pureconfig.generic.auto._ - -case class StoreConfiguration( - dataStoreType: DataStoreType, - options: Option[Map[String, String]] = None -) { - def getDataStore: DataStore = dataStoreType.getDataStore(options.getOrElse(Map())) - def getDataStore(namespace: String): DataStore = getDataStore(namespace.some) - def getDataStore(namespace: Option[String]): DataStore = { - val opts = options.getOrElse(Map()) - dataStoreType.getDataStore(namespace.fold(opts)(ns => opts + ("gwNamespace" -> ns))) - } -} - -object StoreConfiguration { - lazy val load: StoreConfiguration = ConfigSource.default.at("geotrellis.geowave.connection.store").loadOrThrow[StoreConfiguration] - - implicit def StoreConfigurationToClass(obj: StoreConfiguration.type): StoreConfiguration = load -} diff --git a/geowave/src/main/scala/geotrellis/geowave/conf/package.scala b/geowave/src/main/scala/geotrellis/geowave/conf/package.scala deleted file mode 100644 index cb58c2bead..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/conf/package.scala +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave - -package object conf extends conf.Implicits diff --git a/geowave/src/main/scala/geotrellis/geowave/dsl/DataAdapterParameters.scala b/geowave/src/main/scala/geotrellis/geowave/dsl/DataAdapterParameters.scala deleted file mode 100644 index a0ffca94c8..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/dsl/DataAdapterParameters.scala +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.dsl - -import cats.syntax.either._ -import geotrellis.geowave.adapter.{DataType, TypeName} -import geotrellis.geowave.dsl.json.{JsonValidator, _} -import io.circe.generic.extras.ConfiguredJsonCodec - -trait DataAdapterParameters { - /** Adapter name with configured indexes - * This is going to be used as a name for [[geotrellis.geowave.adapter.GeoTrellisDataAdapter]] - */ - def typeName: TypeName - - /** Name of data type supported by the Adapter - * This is used to produce an adapter instance that will be registered with given index - */ - def dataType: DataType - - /** Storage (i.e. Cassandra) namespace to be used for connection - * Follow up ingest message should be using consistent namespace values - */ - def namespace: Option[String] -} - -object DataAdapterParameters { - @ConfiguredJsonCodec - case class Header(typeName: TypeName, dataType: DataType, namespace: Option[String]) extends DataAdapterParameters - - implicit val ingestParametersValidator: JsonValidator[DataAdapterParameters.Header] = { json => - JsonValidator - .validateMessageHeader(json) - .toEither - .flatMap(_ => json.as[DataAdapterParameters.Header].leftMap(JsonValidatorErrors(_))) - } -} diff --git a/geowave/src/main/scala/geotrellis/geowave/dsl/DataTypeReader.scala b/geowave/src/main/scala/geotrellis/geowave/dsl/DataTypeReader.scala deleted file mode 100644 index 6129f7d26f..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/dsl/DataTypeReader.scala +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.dsl - -import java.net.URI - -import cats.~> - -/** DataTypeReader abstracts over the ability to read and split a data format during ingest. - * The type encoding is controlled by the M type parameter. - * It is therefore possible to read GeoTiff multiple ways by varying O and M - */ -trait DataTypeReader[F[_], O, R] { self => - def read(uri: URI, options: Option[O]): F[Iterator[R]] - - def mapK[G[_]](f: F ~> G): DataTypeReader[G, O, R] = new DataTypeReader[G, O, R] { - def read(uri: URI, options: Option[O]): G[Iterator[R]] = f(self.read(uri, options)) - } -} \ No newline at end of file diff --git a/geowave/src/main/scala/geotrellis/geowave/dsl/DeleteParameters.scala b/geowave/src/main/scala/geotrellis/geowave/dsl/DeleteParameters.scala deleted file mode 100644 index e12056059b..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/dsl/DeleteParameters.scala +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.dsl - -import cats.instances.option._ -import cats.syntax.either._ -import cats.syntax.semigroup._ -import geotrellis.geowave.adapter.TypeName -import geotrellis.geowave.api._ -import geotrellis.geowave.dsl.json._ -import geotrellis.geowave.index.dimension.ElevationDefinition -import io.circe.generic.extras.ConfiguredJsonCodec -import geotrellis.vector._ -import org.locationtech.geowave.core.geotime.index.dimension.{SimpleTimeDefinition, TimeDefinition} -import org.locationtech.geowave.core.geotime.store.dimension.Time.TimeRange -import org.locationtech.geowave.core.geotime.util.GeometryUtils -import org.locationtech.geowave.core.index.sfc.data.NumericRange -import org.locationtech.geowave.core.store.query.constraints.BasicQueryByClass.{ConstraintData, ConstraintSet, ConstraintsByClass} -import org.locationtech.geowave.core.store.query.filter.BasicQueryFilter - -@ConfiguredJsonCodec -case class DeleteParameters( - typeName: TypeName, - indexName: String, - geometry: Option[Geometry] = None, - namespace: Option[String] = None, - time: Option[TimeRange] = None, - elevation: Option[NumericRange] = None, - compareOp: BasicQueryFilter.BasicQueryCompareOperation = BasicQueryFilter.BasicQueryCompareOperation.INTERSECTS -) extends QueryConfiguration { - def constraints: Option[ConstraintsByClass] = { - val gc = geometry.map(GeometryUtils.basicConstraintsFromGeometry) - val tc = time.map { timeRange => - new ConstraintsByClass( - new ConstraintSet( - new ConstraintData(timeRange.toNumericData(), false), - classOf[TimeDefinition], - classOf[SimpleTimeDefinition] - ) - ) - } - val dc = elevation.map { elevationRange => - new ConstraintsByClass( - new ConstraintSet( - new ConstraintData(elevationRange, false), - classOf[ElevationDefinition] - ) - ) - } - - (gc |+| tc) |+| dc - } -} - -object DeleteParameters { - implicit val deleteParametersValidator: JsonValidator[DeleteParameters] = { json => - JsonValidator - .validateDeleteParameters(json) - .toEither - .flatMap(_ => json.as[DeleteParameters].leftMap(JsonValidatorErrors(_))) - } -} diff --git a/geowave/src/main/scala/geotrellis/geowave/dsl/IndexParameters.scala b/geowave/src/main/scala/geotrellis/geowave/dsl/IndexParameters.scala deleted file mode 100644 index d11a4189c9..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/dsl/IndexParameters.scala +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.dsl - -import cats.syntax.either._ -import geotrellis.geowave.adapter.{DataType, TypeName} -import geotrellis.geowave.conf.StoreConfiguration -import geotrellis.geowave.dsl.json.{JsonValidator, _} -import io.circe.generic.extras.ConfiguredJsonCodec -import org.locationtech.geowave.core.store.api.{DataStore, Index} - -/** Kafka message to configure and create an index for specific data type - * - * @param indices List of index definitions that would be used by an adapter - * @param typeName Name of the type to be used in the table - * @param dataType Data type to expect for ingest - * @param namespace Store (i.e. Cassandra) namespace - */ -@ConfiguredJsonCodec -case class IndexParameters( - /** A list of [[IndexDefinition]]s - * Each index corresponds to a table in which each record will be stored - */ - indices: List[IndexDefinition], - - /** Adapter name with configured indexes - * This is going to be used as a name for [[geotrellis.geowave.adapter.GeoTrellisDataAdapter]] - */ - typeName: TypeName, - - /** Name of data type supported by the Adapter - * This is used to produce an adapter instance that will be registered with given index - */ - dataType: DataType, - - /** Storage (i.e. Cassandra) namespace to be used for connection - * Follow up ingest message should be using consistent namespace values - */ - namespace: Option[String] = None -) extends DataAdapterParameters { - def dataStore: DataStore = StoreConfiguration.getDataStore(namespace) -} - -object IndexParameters { - implicit val indexParametersValidator: JsonValidator[IndexParameters] = { json => - JsonValidator - .validateIndexParameters(json) - .toEither - .flatMap(_ => json.as[IndexParameters].leftMap(JsonValidatorErrors(_))) - } -} - -/** Each adapter can have a relation to multiple indicies. - * This class defines a single Index definition - * - * @param indexName Unique name for index instance - * The instance captures index type (ex: spatial, spatial_temporal) and the parameters, dimension resolutions and or bounds - * This name will be auto-generated based on index type and options but may be overwritten here - * - * The index name is used as table name for all ingested data. - * Using this ... - * @param indexType Name of the index type available through GeoWave IndexPlugin SPI - * @param indexOptions Index Options specific to each [[indexType]] within GeoWave IndexPlugin SPI - * These are options may be configured through: - * 'org.locationtech.geowave.core.store.spi.DimensionalityTypeProviderSpi' - */ -@ConfiguredJsonCodec -case class IndexDefinition( - indexName: Option[String], - indexType: IndexType, - indexOptions: Map[String, String] -) { - def getIndex: Index = indexType.getIndex(indexOptions, indexName) -} - -object IndexDefinition { - implicit def indexDefinitiontoList(indexDefinition: IndexDefinition): List[IndexDefinition] = indexDefinition :: Nil -} \ No newline at end of file diff --git a/geowave/src/main/scala/geotrellis/geowave/dsl/IngestParameters.scala b/geowave/src/main/scala/geotrellis/geowave/dsl/IngestParameters.scala deleted file mode 100644 index c1520c4ea0..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/dsl/IngestParameters.scala +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.dsl - -import java.net.URI - -import cats.syntax.either._ -import geotrellis.geowave.adapter.{DataType, TypeName} -import geotrellis.geowave.conf.StoreConfiguration -import geotrellis.geowave.dsl.json.{JsonValidator, _} -import io.circe.generic.extras.semiauto._ -import io.circe.{Decoder, Encoder} -import org.locationtech.geowave.core.store.api.{DataStore, Writer} - -case class IngestParameters[A]( - typeName: TypeName, - dataType: DataType, - uri: URI, - options: Option[A] = None, - namespace: Option[String] = None -) extends DataAdapterParameters { - def dataStore: DataStore = StoreConfiguration.getDataStore(namespace) - def writer[T]: Writer[T] = dataStore.createWriter[T](typeName.value) -} - -object IngestParameters { - implicit def ingestParametersDecoder[A: Decoder] = deriveConfiguredDecoder[IngestParameters[A]] - implicit def ingestParametersEncoder[A: Encoder] = deriveConfiguredEncoder[IngestParameters[A]] - - implicit def ingestParametersValidator[A: Decoder]: JsonValidator[IngestParameters[A]] = { json => - JsonValidator - .validateIngestParameters(json) - .toEither - .flatMap(_ => json.as[IngestParameters[A]].leftMap(JsonValidatorErrors(_))) - } -} diff --git a/geowave/src/main/scala/geotrellis/geowave/dsl/Metadata.scala b/geowave/src/main/scala/geotrellis/geowave/dsl/Metadata.scala deleted file mode 100644 index df0a195315..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/dsl/Metadata.scala +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.dsl - -import geotrellis.layer.MapKeyTransform -import geotrellis.raster.RasterExtent -import geotrellis.vector.Extent - -trait Metadata { - type VoxelBoundsInternal <: VoxelBounds - def bounds: VoxelBoundsInternal - def extent: Extent - - def mapKeyTransform: MapKeyTransform = MapKeyTransform(extent, bounds.colMax, bounds.rowMax) - def rasterExtent: RasterExtent = RasterExtent(extent, bounds.colMax + 1, bounds.rowMax + 1) -} diff --git a/geowave/src/main/scala/geotrellis/geowave/dsl/QueryConfiguration.scala b/geowave/src/main/scala/geotrellis/geowave/dsl/QueryConfiguration.scala deleted file mode 100644 index 4630a2fc24..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/dsl/QueryConfiguration.scala +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.dsl - -import geotrellis.geowave.adapter.TypeName -import geotrellis.geowave.api.SQueryBuilder -import geotrellis.geowave.conf.StoreConfiguration -import org.locationtech.geowave.core.store.api.{DataStore, Query, Writer} -import org.locationtech.geowave.core.store.query.constraints.BasicQueryByClass -import org.locationtech.geowave.core.store.query.constraints.BasicQueryByClass.ConstraintsByClass -import org.locationtech.geowave.core.store.query.filter.BasicQueryFilter - -trait QueryConfiguration { - def compareOp: BasicQueryFilter.BasicQueryCompareOperation - def constraints: Option[ConstraintsByClass] - def query: Query[_] = { - val q = SQueryBuilder - .newBuilder - .addTypeName(typeName.value) - .indexName(indexName) - - constraints.fold(q.build)(c => q.constraints(new BasicQueryByClass(c, compareOp)).build) - } - - def indexName: String - def typeName: TypeName - def namespace: Option[String] - def dataStore: DataStore = StoreConfiguration.getDataStore(namespace) - def writer[T]: Writer[T] = dataStore.createWriter[T](typeName.value) -} \ No newline at end of file diff --git a/geowave/src/main/scala/geotrellis/geowave/dsl/TilingBounds.scala b/geowave/src/main/scala/geotrellis/geowave/dsl/TilingBounds.scala deleted file mode 100644 index b1c1a864fb..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/dsl/TilingBounds.scala +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.dsl - -import geotrellis.geowave.dsl.json._ -import io.circe.generic.extras.ConfiguredJsonCodec - -@ConfiguredJsonCodec -case class TilingBounds( - width: Option[Int] = None, - height: Option[Int] = None, - depth: Option[Int] = None, - spissitude: Option[Int] = None -) \ No newline at end of file diff --git a/geowave/src/main/scala/geotrellis/geowave/dsl/VoxelBounds.scala b/geowave/src/main/scala/geotrellis/geowave/dsl/VoxelBounds.scala deleted file mode 100644 index 7befb2c755..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/dsl/VoxelBounds.scala +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.dsl - -import geotrellis.raster.GridBounds - -/** VoxelBounds that we'll use for the internal API that allows to abstract over bounds dimensions; Doxel Bounds? */ -trait VoxelBounds { self => - def colMin: Int - def colMax: Int - def rowMin: Int - def rowMax: Int - def toGridBounds: GridBounds[Int] = GridBounds[Int](colMin, rowMin, colMax, rowMax) -} diff --git a/geowave/src/main/scala/geotrellis/geowave/dsl/VoxelBounds2D.scala b/geowave/src/main/scala/geotrellis/geowave/dsl/VoxelBounds2D.scala deleted file mode 100644 index 022a7823f7..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/dsl/VoxelBounds2D.scala +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.dsl - -import geotrellis.raster.split.Split.Options -import spire.syntax.cfor.cfor - -case class VoxelBounds2D(colMin: Int, colMax: Int, rowMin: Int, rowMax: Int) extends VoxelBounds { - def toVoxelDimensions: VoxelDimensions2D = VoxelDimensions2D(colMax - colMin, rowMax - rowMin) - - def split(tb: TilingBounds): Seq[VoxelBounds2D] = split(toVoxelDimensions.withTilingBounds(tb)) - - def split(tb: TilingBounds, options: Options): Seq[VoxelBounds2D] = split(toVoxelDimensions.withTilingBounds(tb), options) - - def split(dims: VoxelDimensions2D): Seq[VoxelBounds2D] = split(dims, Options.DEFAULT) - - def split(dims: VoxelDimensions2D, options: Options): Seq[VoxelBounds2D] = { - val (tileCols, tileRows) = dims.width -> dims.height - val (layoutCols, layoutRows) = (colMax / dims.width, rowMax / dims.height) - - val splits = Array.ofDim[VoxelBounds2D](layoutCols * layoutRows) - - cfor(0)(_ < layoutRows, _ + 1) { layoutRow => - cfor(0)(_ < layoutCols, _ + 1) { layoutCol => - val firstCol = layoutCol * tileCols - val lastCol = { - val x = firstCol + tileCols - 1 - if (!options.extend && x > tileCols - 1) tileCols - 1 - else x - } - val firstRow = layoutRow * tileRows - val lastRow = { - val x = firstRow + tileRows - 1 - if (!options.extend && x > tileRows - 1) tileRows - 1 - else x - } - - val vb = VoxelBounds2D(firstCol, lastCol, firstRow, lastRow) - splits(layoutRow * layoutCols + layoutCol) = vb - } - } - - splits.toSeq - } -} \ No newline at end of file diff --git a/geowave/src/main/scala/geotrellis/geowave/dsl/VoxelBounds3D.scala b/geowave/src/main/scala/geotrellis/geowave/dsl/VoxelBounds3D.scala deleted file mode 100644 index 1f953af2a7..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/dsl/VoxelBounds3D.scala +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.dsl - -import geotrellis.raster.split.Split.Options -import spire.syntax.cfor.cfor - -case class VoxelBounds3D( - colMin: Int, colMax: Int, - rowMin: Int, rowMax: Int, - depthMin: Int, depthMax: Int -) extends VoxelBounds { - def toVoxelDimensions: VoxelDimensions3D = VoxelDimensions3D(colMax - colMin, rowMax - rowMin, depthMax - depthMin) - def split(tb: TilingBounds): Seq[VoxelBounds3D] = split(toVoxelDimensions.withTilingBounds(tb)) - def split(tb: TilingBounds, options: Options): Seq[VoxelBounds3D] = split(toVoxelDimensions.withTilingBounds(tb), options) - def split(dims: VoxelDimensions3D): Seq[VoxelBounds3D] = split(dims, Options.DEFAULT) - def split(dims: VoxelDimensions3D, options: Options = Options.DEFAULT): Seq[VoxelBounds3D] = { - val (tileCols, tileRows, tileDepths) = (dims.width, dims.height, dims.depth) - val (layoutCols, layoutRows, layoutDepths) = (colMax / dims.width, rowMax / dims.height, depthMax / dims.depth) - - val splits = Array.ofDim[VoxelBounds3D](layoutCols * layoutRows * layoutDepths) - - cfor(0)(_ < layoutDepths, _ + 1) { layoutDepth => - cfor(0)(_ < layoutRows, _ + 1) { layoutRow => - cfor(0)(_ < layoutCols, _ + 1) { layoutCol => - val firstCol = layoutCol * tileCols - val lastCol = { - val x = firstCol + tileCols - 1 - if (!options.extend && x > tileCols - 1) tileCols - 1 - else x - } - val firstRow = layoutRow * tileRows - val lastRow = { - val x = firstRow + tileRows - 1 - if (!options.extend && x > tileRows - 1) tileRows - 1 - else x - } - val firstDepth = layoutDepth * tileDepths - val lastDepth = { - val x = firstDepth + tileDepths - 1 - if (!options.extend && x > tileDepths - 1) tileDepths - 1 - else x - } - - val vb = VoxelBounds3D(firstCol, lastCol, firstRow, lastRow, firstDepth, lastDepth) - splits(layoutDepth * layoutCols * layoutRows + layoutRow * layoutCols + layoutCol) = vb - } - } - } - - splits.toSeq - } -} diff --git a/geowave/src/main/scala/geotrellis/geowave/dsl/VoxelBounds4D.scala b/geowave/src/main/scala/geotrellis/geowave/dsl/VoxelBounds4D.scala deleted file mode 100644 index a63531935c..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/dsl/VoxelBounds4D.scala +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.dsl - -import geotrellis.raster.split.Split.Options -import spire.syntax.cfor.cfor - -case class VoxelBounds4D( - colMin: Int, colMax: Int, - rowMin: Int, rowMax: Int, - depthMin: Int, depthMax: Int, - spissitudeMin: Int, spissitudeMax: Int -) extends VoxelBounds { - def toVoxelDimensions: VoxelDimensions4D = VoxelDimensions4D(colMax - colMin, rowMax - rowMin, depthMax - depthMin, spissitudeMax - spissitudeMin) - def split(tb: TilingBounds): Seq[VoxelBounds4D] = split(toVoxelDimensions.withTilingBounds(tb)) - def split(tb: TilingBounds, options: Options): Seq[VoxelBounds4D] = split(toVoxelDimensions.withTilingBounds(tb), options) - def split(dims: VoxelDimensions4D): Seq[VoxelBounds4D] = split(dims, Options.DEFAULT) - def split(dims: VoxelDimensions4D, options: Options = Options.DEFAULT): Seq[VoxelBounds4D] = { - val (tileCols, tileRows, tileDepths, tileSpissitudes) = (dims.width, dims.height, dims.depth, dims.spissitude) - val (layoutCols, layoutRows, layoutDepths, layoutSpissitudes) = (colMax / dims.width, rowMax / dims.height, depthMax / dims.depth, spissitudeMax / dims.spissitude) - - val splits = Array.ofDim[VoxelBounds4D](layoutCols * layoutRows * layoutDepths * layoutSpissitudes) - - cfor(0)(_ < layoutSpissitudes, _ + 1) { layoutSpissitude => - cfor(0)(_ < layoutDepths, _ + 1) { layoutDepth => - cfor(0)(_ < layoutRows, _ + 1) { layoutRow => - cfor(0)(_ < layoutCols, _ + 1) { layoutCol => - val firstCol = layoutCol * tileCols - val lastCol = { - val x = firstCol + tileCols - 1 - if (!options.extend && x > tileCols - 1) tileCols - 1 - else x - } - val firstRow = layoutRow * tileRows - val lastRow = { - val x = firstRow + tileRows - 1 - if (!options.extend && x > tileRows - 1) tileRows - 1 - else x - } - val firstDepth = layoutDepth * tileDepths - val lastDepth = { - val x = firstDepth + tileDepths - 1 - if (!options.extend && x > tileDepths - 1) tileDepths - 1 - else x - } - val firstSpissitude = layoutSpissitude * tileSpissitudes - val lastSpissitude = { - val x = firstSpissitude + tileSpissitudes - 1 - if (!options.extend && x > tileSpissitudes - 1) tileSpissitudes - 1 - else x - } - - val vb = VoxelBounds4D(firstCol, lastCol, firstRow, lastRow, firstDepth, lastDepth, firstSpissitude, lastSpissitude) - splits(layoutSpissitude * layoutDepths * layoutCols * layoutRows + layoutDepth * layoutCols * layoutRows + layoutRow * layoutCols + layoutCol) = vb - } - } - } - } - - splits.toSeq - } -} diff --git a/geowave/src/main/scala/geotrellis/geowave/dsl/VoxelDimensions.scala b/geowave/src/main/scala/geotrellis/geowave/dsl/VoxelDimensions.scala deleted file mode 100644 index f0e6b1b4ec..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/dsl/VoxelDimensions.scala +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.dsl - -import geotrellis.raster.Dimensions -import geotrellis.geowave.dsl.json._ -import io.circe.generic.extras.ConfiguredJsonCodec - -@ConfiguredJsonCodec -sealed trait VoxelDimensions { self => - def width: Int - def height: Int - def toVoxelBounds: VoxelBounds - def toDimensions: Dimensions[Int] = Dimensions[Int](width, height) - def withTilingBounds(tb: TilingBounds): VoxelDimensions -} - -@ConfiguredJsonCodec -case class VoxelDimensions2D(width: Int, height: Int) extends VoxelDimensions { - def toVoxelBounds: VoxelBounds2D = VoxelBounds2D(0, width, 0, height) - def withTilingBounds(tb: TilingBounds): VoxelDimensions2D = - VoxelDimensions2D(tb.width.getOrElse(width), tb.height.getOrElse(height)) -} -@ConfiguredJsonCodec -case class VoxelDimensions3D(width: Int, height: Int, depth: Int) extends VoxelDimensions { - def toVoxelBounds: VoxelBounds3D = VoxelBounds3D(0, width, 0, height, 0, depth) - def withTilingBounds(tb: TilingBounds): VoxelDimensions3D = - VoxelDimensions3D(tb.width.getOrElse(width), tb.height.getOrElse(height), tb.depth.getOrElse(depth)) -} -@ConfiguredJsonCodec -case class VoxelDimensions4D(width: Int, height: Int, depth: Int, spissitude: Int) extends VoxelDimensions { - def toVoxelBounds: VoxelBounds4D = VoxelBounds4D(0, width, 0, height, 0, depth, 0, spissitude) - def withTilingBounds(tb: TilingBounds): VoxelDimensions4D = - VoxelDimensions4D(tb.width.getOrElse(width), tb.height.getOrElse(height), tb.depth.getOrElse(depth), tb.spissitude.getOrElse(spissitude)) -} diff --git a/geowave/src/main/scala/geotrellis/geowave/dsl/avro/GeometryCodecs.scala b/geowave/src/main/scala/geotrellis/geowave/dsl/avro/GeometryCodecs.scala deleted file mode 100644 index 2c5c47ba23..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/dsl/avro/GeometryCodecs.scala +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.dsl.avro - -import geotrellis.store.avro._ -import geotrellis.vector.{Point, Polygon} -import org.apache.avro.generic.GenericRecord -import org.apache.avro.{Schema, SchemaBuilder} -import org.locationtech.jts.geom.Coordinate - -import scala.collection.JavaConverters._ - -trait GeometryCodecs { - implicit def coordinateCodec: AvroRecordCodec[Coordinate] = new AvroRecordCodec[Coordinate]() { - override def schema: Schema = SchemaBuilder - .record("Coordinate") - .namespace("org.locationtech.jts.geom") - .fields() - .name("x").`type`.doubleType().noDefault - .name("y").`type`.doubleType().noDefault - .name("z").`type`.doubleType().noDefault - .endRecord() - - override def encode(c: Coordinate, rec: GenericRecord): Unit = { - rec.put("x", c.getX) - rec.put("y", c.getY) - rec.put("z", c.getZ) - } - - override def decode(rec: GenericRecord): Coordinate = { - new Coordinate( - rec[Double]("x"), - rec[Double]("y"), - rec[Double]("z") - ) - } - } - - implicit def pointCodec: AvroRecordCodec[Point] = new AvroRecordCodec[Point] { - def schema = SchemaBuilder - .record("Point") - .namespace("geotrellis.vector") - .fields() - .name("coordinate").`type`(AvroRecordCodec[Coordinate].schema).noDefault - .name("srid").`type`.intType.noDefault - .endRecord() - - def encode(thing: Point, rec: GenericRecord): Unit = { - rec.put("coordinate", AvroRecordCodec[Coordinate].encode(thing.getCoordinate)) - rec.put("srid", thing.getSRID) - } - - def decode(rec: GenericRecord): Point = { - val coordinate = AvroRecordCodec[Coordinate].decode(rec[GenericRecord]("coordinate")) - val point = Point(coordinate) - point.setSRID(rec[Int]("srid")) - point - } - } - - implicit def polygonCodec: AvroRecordCodec[Polygon] = new AvroRecordCodec[Polygon] { - override def schema: Schema = SchemaBuilder - .record("Polygon") - .namespace("geotrellis.vector") - .fields - .name("coordinates").`type`.array.items(AvroRecordCodec[Coordinate].schema).noDefault - .name("srid").`type`.intType.noDefault - .endRecord - - override def encode(thing: Polygon, rec: GenericRecord): Unit = { - val coordinates = java.util.Arrays.asList(thing.getCoordinates.map(coordinateCodec.encode): _*) - rec.put("coordinates", coordinates) - rec.put("srid", thing.getSRID) - } - - override def decode(rec: GenericRecord): Polygon = { - val coordinates = rec.get("coordinates") - .asInstanceOf[java.util.Collection[GenericRecord]] - .asScala - .toArray[GenericRecord] - .map(coordinateCodec.decode) - val polygon = Polygon(coordinates) - polygon.setSRID(rec[Int]("srid")) - polygon - } - } -} diff --git a/geowave/src/main/scala/geotrellis/geowave/dsl/avro/Implicits.scala b/geowave/src/main/scala/geotrellis/geowave/dsl/avro/Implicits.scala deleted file mode 100644 index 8f9d60f842..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/dsl/avro/Implicits.scala +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.dsl.avro - -trait Implicits extends GeometryCodecs with VoxelBoundsCodec with VoxelDimensionsCodec - -object Implicits extends Implicits diff --git a/geowave/src/main/scala/geotrellis/geowave/dsl/avro/VoxelBoundsCodec.scala b/geowave/src/main/scala/geotrellis/geowave/dsl/avro/VoxelBoundsCodec.scala deleted file mode 100644 index b444ddd7b7..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/dsl/avro/VoxelBoundsCodec.scala +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.dsl.avro - -import geotrellis.geowave.dsl._ -import geotrellis.store.avro._ -import org.apache.avro.SchemaBuilder -import org.apache.avro.generic.GenericRecord - -trait VoxelBoundsCodec { - implicit def voxelBounds2DCodec: AvroRecordCodec[VoxelBounds2D] = new AvroRecordCodec[VoxelBounds2D] { - def schema = SchemaBuilder - .record("VoxelBounds2D").namespace("geotrellis.geowave.dsl") - .fields() - .name("colMin").`type`.intType().noDefault - .name("colMax").`type`.intType().noDefault - .name("rowMin").`type`.intType().noDefault - .name("rowMax").`type`.intType().noDefault - .endRecord() - - def encode(bounds: VoxelBounds2D, rec: GenericRecord): Unit = { - rec.put("colMin", bounds.colMin) - rec.put("colMax", bounds.colMin) - rec.put("rowMin", bounds.rowMin) - rec.put("rowMax", bounds.rowMax) - } - - def decode(rec: GenericRecord): VoxelBounds2D = - VoxelBounds2D( - rec[Int]("colMin"), - rec[Int]("colMax"), - rec[Int]("rowMin"), - rec[Int]("rowMax") - ) - } - - implicit def voxelBounds3DCodec: AvroRecordCodec[VoxelBounds3D] = new AvroRecordCodec[VoxelBounds3D] { - def schema = SchemaBuilder - .record("VoxelBounds3D").namespace("geotrellis.geowave.dsl") - .fields() - .name("colMin").`type`.intType().noDefault - .name("colMax").`type`.intType().noDefault - .name("rowMin").`type`.intType().noDefault - .name("rowMax").`type`.intType().noDefault - .name("depthMin").`type`.intType().noDefault - .name("depthMax").`type`.intType().noDefault - .endRecord() - - def encode(bounds: VoxelBounds3D, rec: GenericRecord): Unit = { - rec.put("colMin", bounds.colMin) - rec.put("colMax", bounds.colMin) - rec.put("rowMin", bounds.rowMin) - rec.put("rowMax", bounds.rowMax) - rec.put("depthMin", bounds.depthMin) - rec.put("depthMax", bounds.depthMax) - } - - def decode(rec: GenericRecord): VoxelBounds3D = - VoxelBounds3D( - rec[Int]("colMin"), - rec[Int]("colMax"), - rec[Int]("rowMin"), - rec[Int]("rowMax"), - rec[Int]("depthMin"), - rec[Int]("depthMax") - ) - } - - implicit def voxelBounds4DCodec: AvroRecordCodec[VoxelBounds4D] = new AvroRecordCodec[VoxelBounds4D] { - def schema = SchemaBuilder - .record("VoxelBounds4D").namespace("geotrellis.geowave.dsl") - .fields() - .name("colMin").`type`.intType().noDefault - .name("colMax").`type`.intType().noDefault - .name("rowMin").`type`.intType().noDefault - .name("rowMax").`type`.intType().noDefault - .name("depthMin").`type`.intType().noDefault - .name("depthMax").`type`.intType().noDefault - .name("spissitudeMin").`type`.intType().noDefault - .name("spissitudeMax").`type`.intType().noDefault - .endRecord() - - def encode(bounds: VoxelBounds4D, rec: GenericRecord): Unit = { - rec.put("colMin", bounds.colMin) - rec.put("colMax", bounds.colMin) - rec.put("rowMin", bounds.rowMin) - rec.put("rowMax", bounds.rowMax) - rec.put("depthMin", bounds.depthMin) - rec.put("depthMax", bounds.depthMax) - rec.put("spissitudeMin", bounds.spissitudeMin) - rec.put("spissitudeMax", bounds.spissitudeMax) - } - - def decode(rec: GenericRecord): VoxelBounds4D = - VoxelBounds4D( - rec[Int]("colMin"), - rec[Int]("colMax"), - rec[Int]("rowMin"), - rec[Int]("rowMax"), - rec[Int]("depthMin"), - rec[Int]("depthMax"), - rec[Int]("spissitudeMin"), - rec[Int]("spissitudeMax") - ) - } -} diff --git a/geowave/src/main/scala/geotrellis/geowave/dsl/avro/VoxelDimensionsCodec.scala b/geowave/src/main/scala/geotrellis/geowave/dsl/avro/VoxelDimensionsCodec.scala deleted file mode 100644 index 5570b90839..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/dsl/avro/VoxelDimensionsCodec.scala +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.dsl.avro - -import geotrellis.geowave.dsl._ -import geotrellis.store.avro._ -import org.apache.avro.SchemaBuilder -import org.apache.avro.generic.GenericRecord - -trait VoxelDimensionsCodec { - implicit def voxelDimensions2DCodec: AvroRecordCodec[VoxelDimensions2D] = new AvroRecordCodec[VoxelDimensions2D] { - def schema = SchemaBuilder - .record("VoxelDimensions2D").namespace("geotrellis.geowave.dsl") - .fields() - .name("width").`type`.intType().noDefault - .name("height").`type`.intType().noDefault - .endRecord() - - def encode(bounds: VoxelDimensions2D, rec: GenericRecord): Unit = { - rec.put("width", bounds.width) - rec.put("height", bounds.height) - } - - def decode(rec: GenericRecord): VoxelDimensions2D = - VoxelDimensions2D( - rec[Int]("width"), - rec[Int]("height") - ) - } - - implicit def voxelDimensions3DCodec: AvroRecordCodec[VoxelDimensions3D] = new AvroRecordCodec[VoxelDimensions3D] { - def schema = SchemaBuilder - .record("VoxelDimensions3D").namespace("geotrellis.geowave.dsl") - .fields() - .name("width").`type`.intType().noDefault - .name("height").`type`.intType().noDefault - .name("depth").`type`.intType().noDefault - .endRecord() - - def encode(bounds: VoxelDimensions3D, rec: GenericRecord): Unit = { - rec.put("width", bounds.width) - rec.put("height", bounds.height) - rec.put("depth", bounds.depth) - } - - def decode(rec: GenericRecord): VoxelDimensions3D = - VoxelDimensions3D( - rec[Int]("width"), - rec[Int]("height"), - rec[Int]("depth") - ) - } - - implicit def voxelDimensions4DCodec: AvroRecordCodec[VoxelDimensions4D] = new AvroRecordCodec[VoxelDimensions4D] { - def schema = SchemaBuilder - .record("VoxelDimensions4D").namespace("com.azavea.api") - .fields() - .name("width").`type`.intType().noDefault - .name("height").`type`.intType().noDefault - .name("depth").`type`.intType().noDefault - .name("spissitude").`type`.intType().noDefault - .endRecord() - - def encode(bounds: VoxelDimensions4D, rec: GenericRecord): Unit = { - rec.put("width", bounds.width) - rec.put("height", bounds.height) - rec.put("depth", bounds.depth) - rec.put("spissitude", bounds.spissitude) - } - - def decode(rec: GenericRecord): VoxelDimensions4D = - VoxelDimensions4D( - rec[Int]("width"), - rec[Int]("height"), - rec[Int]("depth"), - rec[Int]("spissitude") - ) - } -} diff --git a/geowave/src/main/scala/geotrellis/geowave/dsl/avro/package.scala b/geowave/src/main/scala/geotrellis/geowave/dsl/avro/package.scala deleted file mode 100644 index c40bd2077b..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/dsl/avro/package.scala +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.dsl - -package object avro extends avro.Implicits diff --git a/geowave/src/main/scala/geotrellis/geowave/dsl/json/Implicits.scala b/geowave/src/main/scala/geotrellis/geowave/dsl/json/Implicits.scala deleted file mode 100644 index 570fa48191..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/dsl/json/Implicits.scala +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.dsl.json - -import java.net.URI -import java.time.Instant - -import cats.syntax.either._ -import geotrellis.geowave.adapter.{DataType, DataTypeRegistry} -import io.circe._ -import io.circe.generic.extras.Configuration -import io.circe.syntax._ -import io.estatico.newtype.Coercible -import org.locationtech.geowave.core.geotime.store.dimension.Time.TimeRange -import org.locationtech.geowave.core.index.sfc.data.NumericRange -import org.locationtech.geowave.core.store.query.filter.BasicQueryFilter - -trait Implicits { - implicit val customConfig: Configuration = Configuration.default.withDiscriminator("classType") - - /** Derive circe codecs for newtypes. */ - implicit def coercibleEncoder[R, N](implicit ev: Coercible[Encoder[R], Encoder[N]], R: Encoder[R]): Encoder[N] = ev(R) - implicit def coercibleDecoder[R, N](implicit ev: Coercible[Decoder[R], Decoder[N]], R: Decoder[R]): Decoder[N] = ev(R) - - /** Overriding auto derived newtype codec to throw a more informative error. */ - implicit val dataTypeDecoder: Decoder[DataType] = Decoder.decodeString.emap { str => - DataTypeRegistry - .find(str) - .fold(s"Invalid DataType: $str; available DataTypes: ${DataTypeRegistry.supportedTypes.mkString(", ")}".asLeft[DataType])(_.asRight) - } - - /** Other Circe codecs */ - implicit val uriEncoder: Encoder[URI] = Encoder.encodeString.contramap[URI](_.toString) - implicit val uriDecoder: Decoder[URI] = Decoder.decodeString.emap { str => - Either.catchNonFatal(URI.create(str)).leftMap(_ => s"Could not decode URI: $str") - } - - implicit val encodeFoo: Encoder[NumericRange] = { numericRange => - Json.obj("min" -> numericRange.getMin.asJson, "max" -> numericRange.getMax.asJson) - } - - implicit val decodeFoo: Decoder[NumericRange] = { c => - for { - min <- c.downField("min").as[Double] - max <- c.downField("max").as[Double] - } yield new NumericRange(min, max) - } - - implicit val encodeTimeRange: Encoder[TimeRange] = { range => - val data = range.toNumericData - Json.obj( - "min" -> Instant.ofEpochMilli(data.getMin.toLong).asJson, - "max" -> Instant.ofEpochMilli(data.getMax.toLong).asJson) - } - - implicit val decodeTimeRange: Decoder[TimeRange] = { c => - for { - min <- c.downField("min").as[Instant] - max <- c.downField("max").as[Instant] - } yield new TimeRange(min.toEpochMilli, max.toEpochMilli) - } - - implicit val basicQueryCompareOperationEncoder: Encoder[BasicQueryFilter.BasicQueryCompareOperation] = - Encoder.encodeString.contramap[BasicQueryFilter.BasicQueryCompareOperation](_.toString) - - implicit val basicQueryCompareOperationDecoder: Decoder[BasicQueryFilter.BasicQueryCompareOperation] = - Decoder.decodeString.emap { str => - Either - .catchNonFatal(BasicQueryFilter.BasicQueryCompareOperation.valueOf(str)) - .leftMap(_ => s"Could not decode BasicQueryCompareOperation: $str") - } -} - -object Implicits extends Implicits diff --git a/geowave/src/main/scala/geotrellis/geowave/dsl/json/JsonValidator.scala b/geowave/src/main/scala/geotrellis/geowave/dsl/json/JsonValidator.scala deleted file mode 100644 index 98e4be3195..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/dsl/json/JsonValidator.scala +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.dsl.json - -import cats.data.Validated -import cats.effect.Sync -import cats.syntax.either._ -import io.circe.Json -import io.circe.schema.Schema - -trait JsonValidator[T] { - def validate(json: Json): Either[JsonValidatorErrors, T] - def parseAndValidate(str: String): Either[JsonValidatorErrors, T] = - io.circe.parser.parse(str).leftMap(JsonValidatorErrors(_)).flatMap(validate) -} - -object JsonValidator { - private def readJson(resource: String): Json = { - val stream = getClass.getResourceAsStream(resource) - try { - val lines = scala.io.Source.fromInputStream(stream).getLines() - val json = lines.mkString(" ") - io.circe.parser.parse(json).valueOr(throw _) - } finally stream.close() - } - - private lazy val messageHeaderSchema = Schema.load(readJson("/json/message.schema.json")) - private lazy val indexParametersSchema = Schema.load(readJson("/json/index-message.schema.json")) - private lazy val ingestParametersSchema = Schema.load(readJson("/json/ingest-message.schema.json")) - private lazy val deleteParametersSchema = Schema.load(readJson("/json/delete-message.schema.json")) - - private def validateSchema(schema: Schema, json: Json): Validated[JsonValidatorErrors, Unit] = schema.validate(json).leftMap(JsonValidatorErrors(_)) - def validateMessageHeader(json: Json): Validated[JsonValidatorErrors, Unit] = validateSchema(messageHeaderSchema, json) - def validateIngestParameters(json: Json): Validated[JsonValidatorErrors, Unit] = validateSchema(ingestParametersSchema, json) - def validateIndexParameters(json: Json): Validated[JsonValidatorErrors, Unit] = validateSchema(indexParametersSchema, json) - def validateDeleteParameters(json: Json): Validated[JsonValidatorErrors, Unit] = validateSchema(deleteParametersSchema, json) - - def apply[T](str: String)(implicit validator: JsonValidator[T]) = validator - def parse[T: JsonValidator](str: String) = apply(str).parseAndValidate(str) - def parseF[F[_]: Sync, T: JsonValidator](str: String) = Sync[F].fromEither(apply(str).parseAndValidate(str)) - def parseUnsafe[T: JsonValidator](str: String) = parse[T](str).valueOr(throw _) - def validate[T](json: Json)(implicit validator: JsonValidator[T]) = validator.validate(json) - def validateUnsafe[T: JsonValidator](json: Json) = validate[T](json).valueOr(throw _) -} diff --git a/geowave/src/main/scala/geotrellis/geowave/dsl/json/JsonValidatorErrors.scala b/geowave/src/main/scala/geotrellis/geowave/dsl/json/JsonValidatorErrors.scala deleted file mode 100644 index 0b1ba91e99..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/dsl/json/JsonValidatorErrors.scala +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.dsl.json - -import cats.data.NonEmptyList -import io.circe.schema.ValidationError -import io.circe.{DecodingFailure, Error} - -final case class JsonValidatorErrors(errors: NonEmptyList[Error]) extends Exception { - def toList: List[Error] = errors.head :: errors.tail - - override def getMessage: String = errors.toList.map(_.getMessage).mkString("; ") - override def fillInStackTrace(): Throwable = this -} - -object JsonValidatorErrors { - def apply(err: Error): JsonValidatorErrors = JsonValidatorErrors(NonEmptyList.of(err)) - def apply(nel: NonEmptyList[ValidationError])(implicit di: DummyImplicit): JsonValidatorErrors = JsonValidatorErrors(nel.map(e => DecodingFailure(e.getMessage, Nil))) -} \ No newline at end of file diff --git a/geowave/src/main/scala/geotrellis/geowave/dsl/json/package.scala b/geowave/src/main/scala/geotrellis/geowave/dsl/json/package.scala deleted file mode 100644 index 68426ffa9e..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/dsl/json/package.scala +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.dsl - -package object json extends json.Implicits diff --git a/geowave/src/main/scala/geotrellis/geowave/dsl/package.scala b/geowave/src/main/scala/geotrellis/geowave/dsl/package.scala deleted file mode 100644 index a45a72f401..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/dsl/package.scala +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave - -import geotrellis.geowave.utils._ -import io.estatico.newtype.macros.newsubtype -import org.locationtech.geowave.core.cli.prefix.PrefixedJCommander -import org.locationtech.geowave.core.store.api.{DataStore, Index} -import org.locationtech.geowave.core.store.cli.store.DataStorePluginOptions -import org.locationtech.geowave.core.store.index.IndexPluginOptions - -package object dsl { - - /** Name of index type registered with GeoWave IndexPlugin SPI */ - @newsubtype case class IndexType(value: String) { - def getIndex(options: Map[String, String], indexName: Option[String] = None): Index = { - val outputIndexOptions: IndexPluginOptions = new IndexPluginOptions - outputIndexOptions.selectPlugin(value) - - if(options.nonEmpty) { - val opts = outputIndexOptions.getDimensionalityOptions - val commander = new PrefixedJCommander() - commander.addPrefixedObject(opts) - commander.parse(options.prefixedList: _*) - } - - indexName.foreach(outputIndexOptions.setName) - outputIndexOptions.createIndex() - } - } - - @newsubtype case class DataStoreType(value: String) { - def getDataStore(options: Map[String, String]): DataStore = { - val dataStorePluginOptions = new DataStorePluginOptions() - dataStorePluginOptions.selectPlugin(value) - - if(options.nonEmpty) { - val opts = dataStorePluginOptions.getFactoryOptions - val commander = new PrefixedJCommander() - commander.addPrefixedObject(opts) - commander.parse(options.prefixedList: _*) - } - - dataStorePluginOptions.createDataStore() - } - } -} diff --git a/geowave/src/main/scala/geotrellis/geowave/dsl/syntax/Implicits.scala b/geowave/src/main/scala/geotrellis/geowave/dsl/syntax/Implicits.scala deleted file mode 100644 index e7c512c2b2..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/dsl/syntax/Implicits.scala +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.dsl.syntax - -import geotrellis.geowave.adapter._ -import geotrellis.geowave.dsl._ - -trait Implicits { - implicit class NewtypeOps(val self: String) { - def indexType: IndexType = IndexType(self) - def typeName: TypeName = TypeName(self) - def indexFieldName: IndexFieldName = IndexFieldName(self) - def dataType: DataType = DataType(self) - def dataStoreType: DataStoreType = DataStoreType(self) - } -} - -object Implicits extends Implicits diff --git a/geowave/src/main/scala/geotrellis/geowave/dsl/syntax/package.scala b/geowave/src/main/scala/geotrellis/geowave/dsl/syntax/package.scala deleted file mode 100644 index be610a7b88..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/dsl/syntax/package.scala +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.dsl - -package object syntax extends Implicits diff --git a/geowave/src/main/scala/geotrellis/geowave/index/SpatialTemporalElevationIndexBuilder.scala b/geowave/src/main/scala/geotrellis/geowave/index/SpatialTemporalElevationIndexBuilder.scala deleted file mode 100644 index af3ab4c6df..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/index/SpatialTemporalElevationIndexBuilder.scala +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.index - - -import org.locationtech.geowave.core.store.api.Index -import org.locationtech.geowave.core.store.index.BaseIndexBuilder - -class SpatialTemporalElevationIndexBuilder( - val options: SpatialTemporalElevationOptions = new SpatialTemporalElevationOptions() -) extends BaseIndexBuilder[SpatialTemporalElevationIndexBuilder] { - def createIndex: Index = new SpatialTemporalElevationIndexTypeProvider().createIndex(options) -} \ No newline at end of file diff --git a/geowave/src/main/scala/geotrellis/geowave/index/SpatialTemporalElevationIndexTypeProvider.scala b/geowave/src/main/scala/geotrellis/geowave/index/SpatialTemporalElevationIndexTypeProvider.scala deleted file mode 100644 index a39281bd38..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/index/SpatialTemporalElevationIndexTypeProvider.scala +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.index - -import com.beust.jcommander.IStringConverter -import geotrellis.geowave.index.dimension.ElevationDefinition -import geotrellis.geowave.index.field.ElevationField -import org.geotools.referencing.CRS -import org.locationtech.geowave.core.geotime.index.dimension.TemporalBinningStrategy.Unit -import org.locationtech.geowave.core.geotime.index.dimension.{LatitudeDefinition, LongitudeDefinition, TimeDefinition} -import org.locationtech.geowave.core.geotime.store.dimension._ -import org.locationtech.geowave.core.geotime.util.GeometryUtils -import org.locationtech.geowave.core.index.dimension.NumericDimensionDefinition -import org.locationtech.geowave.core.index.sfc.SFCFactory.SFCType -import org.locationtech.geowave.core.index.sfc.xz.XZHierarchicalIndexFactory -import org.locationtech.geowave.core.store.api.Index -import org.locationtech.geowave.core.store.dimension.NumericDimensionField -import org.locationtech.geowave.core.store.index.{BasicIndexModel, CustomNameIndex} -import org.locationtech.geowave.core.store.spi.DimensionalityTypeProviderSpi -import org.opengis.referencing.crs.CoordinateReferenceSystem -import spire.syntax.cfor._ - -class SpatialTemporalElevationIndexTypeProvider extends DimensionalityTypeProviderSpi[SpatialTemporalElevationOptions] { - import SpatialTemporalElevationIndexTypeProvider._ - - private val DEFAULT_SP_TEMP_ELV_ID_STR = "SP_TEMP_ELV_IDX" - - def getDimensions(options: SpatialTemporalElevationOptions): Array[NumericDimensionDefinition] = - Array( - new LongitudeDefinition(), - new LatitudeDefinition(true), - new TimeDefinition(Unit.YEAR), - new ElevationDefinition(minValue=0, maxValue=options.getMaxElevation) - ) - - def getSpatialTemporalFields(geometryPrecision: Int): Array[NumericDimensionField[_]] = - Array( - new LongitudeField(geometryPrecision), - new LatitudeField(geometryPrecision, true), - new TimeField(Unit.YEAR), - new ElevationField() - ) - - def getDimensionalityTypeName: String = "spatial_temporal_elevation" - - def getDimensionalityTypeDescription: String = "This dimensionality type matches all indices that only require Geometry, Time and Elevation." - - /** - * This is a modified copy of org.locationtech.geowave.core.geotime.ingest.SpatialTemporalDimensionalityTypeProvider::internalCreateIndex: - * https://github.com/locationtech/geowave/blob/v1.0.0/core/geotime/src/main/java/org/locationtech/geowave/core/geotime/ingest/SpatialTemporalDimensionalityTypeProvider.java#L94 - */ - def createIndex(options: SpatialTemporalElevationOptions): Index = { - val geometryPrecision: Int = options.getGeometryPrecision() - - val (dimensions, fields, isDefaultCRS, crsCode) = - if ((options.getCrs == null) || options.getCrs.isEmpty || options.getCrs.equalsIgnoreCase(GeometryUtils.DEFAULT_CRS_STR)) { - (getDimensions(options), getSpatialTemporalFields(geometryPrecision), true, "EPSG:4326") - } else { - val crs = decodeCRS(options.getCrs) - val cs = crs.getCoordinateSystem - val isDefaultCRS = false - val crsCode = options.getCrs - val dimensions = Array.ofDim[NumericDimensionDefinition](cs.getDimension + 2) - val fields = Array.ofDim[NumericDimensionField[_]](dimensions.length) - - cfor(0)(_ < dimensions.length - 2, _ + 1) { d => - val csa = cs.getAxis(d) - dimensions(d) = new CustomCRSBoundedSpatialDimension(d.toByte, csa.getMinimumValue, csa.getMaximumValue) - fields(d) = new CustomCRSSpatialField(dimensions(d).asInstanceOf[CustomCRSBoundedSpatialDimension], geometryPrecision) - } - - val elevationDefinition = new ElevationDefinition(minValue = 0, maxValue = options.getMaxElevation) - dimensions(dimensions.length - 2) = new TimeDefinition(options.getTemporalPerioidicty) - fields(dimensions.length - 2) = new TimeField(options.getTemporalPerioidicty) - dimensions(dimensions.length - 1) = elevationDefinition - fields(dimensions.length - 1) = new ElevationField(baseDefinition = elevationDefinition) - - (dimensions, fields, isDefaultCRS, crsCode) - } - - val indexModel: BasicIndexModel = - if (isDefaultCRS) new BasicIndexModel(fields) else new CustomCrsIndexModel(fields, crsCode) - - // index combinedId - val combinedId: String = - if (isDefaultCRS) s"${DEFAULT_SP_TEMP_ELV_ID_STR}_${options.getBias}_${options.getTemporalPerioidicty}_${options.getMaxElevation}" - else s"${DEFAULT_SP_TEMP_ELV_ID_STR}_${crsCode.substring(crsCode.indexOf(":") + 1)}_${options.getBias}_${options.getTemporalPerioidicty}_${options.getMaxElevation}" - - new CustomNameIndex( - XZHierarchicalIndexFactory.createFullIncrementalTieredStrategy( - dimensions, - Array[Int]( - options.getBias.getSpatialPrecision, - options.getBias.getSpatialPrecision, - options.getBias.getTemporalPrecision, - options.getBias.getSpatialPrecision - ), - SFCType.HILBERT, - options.getMaxDuplicates - ), - indexModel, - combinedId - ) - } - - def createOptions: SpatialTemporalElevationOptions = new SpatialTemporalElevationOptions() -} - -object SpatialTemporalElevationIndexTypeProvider { - class IntConverter extends IStringConverter[Int] { - def convert(value: String): Int = java.lang.Integer.parseUnsignedInt(value) - } - - def decodeCRS(crsCode: String): CoordinateReferenceSystem = CRS.decode(crsCode, true) -} diff --git a/geowave/src/main/scala/geotrellis/geowave/index/SpatialTemporalElevationOptions.scala b/geowave/src/main/scala/geotrellis/geowave/index/SpatialTemporalElevationOptions.scala deleted file mode 100644 index 5129fc0659..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/index/SpatialTemporalElevationOptions.scala +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.index - -import com.beust.jcommander.Parameter -import org.locationtech.geowave.core.geotime.index.SpatialTemporalDimensionalityTypeProvider.Bias -import org.locationtech.geowave.core.geotime.index.dimension.TemporalBinningStrategy -import org.locationtech.geowave.core.geotime.index.dimension.TemporalBinningStrategy.Unit -import org.locationtech.geowave.core.geotime.index.{CommonSpatialOptions, SpatialTemporalDimensionalityTypeProvider} - -class SpatialTemporalElevationOptions extends CommonSpatialOptions { - protected var DEFAULT_TEMPORAL_PERIODICITY = Unit.YEAR - protected var DEFAULT_MAX_ELEVATION = 32000 - - @Parameter( - names = Array("--maxElevation"), - required = false, - description = "The periodicity of the elevation dimension. Because time is continuous, it is binned at this interval.", - converter = classOf[SpatialTemporalElevationIndexTypeProvider.IntConverter] - ) - protected var maxElevation: Int = DEFAULT_MAX_ELEVATION - - @Parameter( - names = Array("--periodTemporal"), - required = false, - description = "The periodicity of the temporal dimension. Because time is continuous, it is binned at this interval.", - converter = classOf[SpatialTemporalDimensionalityTypeProvider.UnitConverter] - ) - protected var temporalPeriodicity: TemporalBinningStrategy.Unit = DEFAULT_TEMPORAL_PERIODICITY - - @Parameter( - names = Array("--bias"), - required = false, - description = "The bias of the spatial-temporal index. There can be more precision given to time or space if necessary.", - converter = classOf[SpatialTemporalDimensionalityTypeProvider.BiasConverter] - ) - protected var bias = Bias.BALANCED - - @Parameter( - names = Array("--maxDuplicates"), - required = false, - description = "The max number of duplicates per dimension range. The default is 2 per range (for example lines and polygon timestamp data would be up to 4 because its 2 dimensions, and line/poly time range data would be 8)." - ) - protected var maxDuplicates: Long = -1 - - def getBias: SpatialTemporalDimensionalityTypeProvider.Bias = bias - - def setBias(bias: SpatialTemporalDimensionalityTypeProvider.Bias) = this.bias = bias - - def getMaxDuplicates: Long = maxDuplicates - - def setMaxDuplicates(maxDuplicates: Long) = this.maxDuplicates = maxDuplicates - - def getTemporalPerioidicty: TemporalBinningStrategy.Unit = temporalPeriodicity - - def setTemporalPerioidicty(temporalPeriodicity: TemporalBinningStrategy.Unit) = this.temporalPeriodicity = temporalPeriodicity - - def getMaxElevation: Int = maxElevation - - def setMaxElevation(x: Int) = this.maxElevation = x - - override def getCrs: String = crs -} diff --git a/geowave/src/main/scala/geotrellis/geowave/index/dimension/Elevation.scala b/geowave/src/main/scala/geotrellis/geowave/index/dimension/Elevation.scala deleted file mode 100644 index 62136b4e75..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/index/dimension/Elevation.scala +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.index.dimension - -import java.nio.ByteBuffer - -import geotrellis.geowave.utils.DoubleUtils -import org.locationtech.geowave.core.index.persist.Persistable -import org.locationtech.geowave.core.index.sfc.data.{NumericData, NumericRange} -import org.locationtech.geowave.core.index.{ByteArrayUtils, VarintUtils} -import org.locationtech.geowave.core.store.dimension.NumericDimensionField -import org.locationtech.geowave.core.store.index.CommonIndexValue - -/** Elevation common index value. - * @param minValue minimum elevation included in this index value, inclusive - * @param maxValue maximum elevation included in this index value, inclusive - */ -class Elevation( - private var minValue: Double = 0d, - private var maxValue: Double = 0d -) extends CommonIndexValue with Persistable { - - private var visibility: Array[Byte] = Array.empty - def getMinValue: Double = minValue - def getMaxValue: Double = maxValue - def getLength: Double = maxValue - minValue - - def toBinary: Array[Byte] = { - val bytes = - ByteBuffer.allocate( - DoubleUtils.doubleByteLength - + DoubleUtils.doubleByteLength - + VarintUtils.unsignedIntByteLength(visibility.length) - + visibility.length - ) - - DoubleUtils.writeDouble(minValue, bytes) - DoubleUtils.writeDouble(maxValue, bytes) - VarintUtils.writeUnsignedInt(visibility.length, bytes) - bytes.put(visibility) - - bytes.array() - } - - def fromBinary(bytes: Array[Byte]): Unit = { - val buf = ByteBuffer.wrap(bytes) - - minValue = DoubleUtils.readDouble(buf) - maxValue = DoubleUtils.readDouble(buf) - val length = VarintUtils.readUnsignedInt(buf) - visibility = ByteArrayUtils.safeRead(buf, length) - } - - def getVisibility: Array[Byte] = visibility - - def setVisibility(bytes: Array[Byte]): Unit = visibility = bytes - - def overlaps(field: Array[NumericDimensionField[_ <: CommonIndexValue]], rangeData: Array[NumericData]): Boolean = { - val nd = rangeData(0) - ((nd.getMin >= getMinValue) && (nd.getMax <= getMaxValue)) || - ((nd.getMin <= getMinValue) && (nd.getMax >= getMinValue)) || - ((nd.getMin <= getMaxValue) && (nd.getMax >= getMaxValue)) - } - - def toNumericData: NumericData = new NumericRange(minValue, maxValue) - - override def toString: String = s"Elevation($minValue, $maxValue)" -} - -object Elevation { - val DEFAULT_FIELD_NAME = "default_elevation_dimension" - def apply(minValue: Double, maxValue: Double): Elevation = new Elevation(minValue, maxValue) - def apply(value: Double): Elevation = new Elevation(value, value) - def apply(): Elevation = new Elevation() -} diff --git a/geowave/src/main/scala/geotrellis/geowave/index/dimension/ElevationDefinition.scala b/geowave/src/main/scala/geotrellis/geowave/index/dimension/ElevationDefinition.scala deleted file mode 100644 index defdb21bde..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/index/dimension/ElevationDefinition.scala +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.index.dimension - -import org.locationtech.geowave.core.index.dimension.BasicDimensionDefinition - -/** - * Elevation dimension definition. - * @note default maxValue assumes elevation will be stored in feet - */ -class ElevationDefinition(minValue: Double = 0 , maxValue: Double = 32000) extends BasicDimensionDefinition(minValue, maxValue) diff --git a/geowave/src/main/scala/geotrellis/geowave/index/dimension/ElevationReader.scala b/geowave/src/main/scala/geotrellis/geowave/index/dimension/ElevationReader.scala deleted file mode 100644 index 2f403deffd..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/index/dimension/ElevationReader.scala +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.index.dimension - -import org.locationtech.geowave.core.store.data.field.FieldReader - -class ElevationReader extends FieldReader[Elevation] { - def readField(bytes: Array[Byte]): Elevation = { val depth = Elevation(); depth.fromBinary(bytes); depth } -} diff --git a/geowave/src/main/scala/geotrellis/geowave/index/dimension/ElevationWriter.scala b/geowave/src/main/scala/geotrellis/geowave/index/dimension/ElevationWriter.scala deleted file mode 100644 index 1c55fead83..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/index/dimension/ElevationWriter.scala +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.index.dimension - -import org.locationtech.geowave.core.store.data.field.FieldWriter - -class ElevationWriter extends FieldWriter[AnyRef, Elevation] { - def writeField(elevation: Elevation): Array[Byte] = elevation.toBinary -} diff --git a/geowave/src/main/scala/geotrellis/geowave/index/field/ElevationField.scala b/geowave/src/main/scala/geotrellis/geowave/index/field/ElevationField.scala deleted file mode 100644 index a4ff12bcac..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/index/field/ElevationField.scala +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.index.field - -import java.nio.ByteBuffer - -import geotrellis.geowave.index.dimension.{Elevation, ElevationDefinition, ElevationReader, ElevationWriter} -import org.locationtech.geowave.core.index.dimension.NumericDimensionDefinition -import org.locationtech.geowave.core.index.dimension.bin.BinRange -import org.locationtech.geowave.core.index.persist.PersistenceUtils -import org.locationtech.geowave.core.index.sfc.data.{NumericData, NumericRange} -import org.locationtech.geowave.core.index.{ByteArrayUtils, StringUtils, VarintUtils} -import org.locationtech.geowave.core.store.data.field.{FieldReader, FieldWriter} -import org.locationtech.geowave.core.store.dimension.NumericDimensionField - -class ElevationField( - private var reader: FieldReader[Elevation] = new ElevationReader(), - private var writer: FieldWriter[AnyRef, Elevation] = new ElevationWriter(), - private var fieldName: String = ElevationField.DEFAULT_FIELD_ID, - private var baseDefinition: NumericDimensionDefinition = new ElevationDefinition(0, 32000) -) extends NumericDimensionField[Elevation] { - - def getNumericData(dataElement: Elevation): NumericData = dataElement.toNumericData - - def getFieldName: String = fieldName - - def getWriter: FieldWriter[_, Elevation] = writer - - def getReader: FieldReader[Elevation] = reader - - def getBaseDefinition: NumericDimensionDefinition = baseDefinition - - def getRange: Double = baseDefinition.getRange - - def normalize(value: Double): Double = baseDefinition.normalize(value) - - def denormalize(value: Double): Double = baseDefinition.denormalize(value) - - def getNormalizedRanges(range: NumericData): Array[BinRange] = baseDefinition.getNormalizedRanges(range) - - def getDenormalizedRange(range: BinRange): NumericRange = baseDefinition.getDenormalizedRange(range) - - def getFixedBinIdSize: Int = baseDefinition.getFixedBinIdSize - - def getBounds: NumericRange = baseDefinition.getBounds - - def getFullRange: NumericData = new NumericRange(0, Int.MaxValue) - - def toBinary: Array[Byte] = { - val dimensionBinary = PersistenceUtils.toBinary(baseDefinition) - val fieldNameBytes = StringUtils.stringToBinary(fieldName) - val buf = - ByteBuffer.allocate( - dimensionBinary.length - + fieldNameBytes.length - + VarintUtils.unsignedIntByteLength(fieldNameBytes.length)) - VarintUtils.writeUnsignedInt(fieldNameBytes.length, buf) - buf.put(fieldNameBytes) - buf.put(dimensionBinary) - buf.array() - } - - def fromBinary(bytes: Array[Byte]): Unit = { - val buf = ByteBuffer.wrap(bytes) - val fieldNameLength = VarintUtils.readUnsignedInt(buf) - val fieldNameBinary = ByteArrayUtils.safeRead(buf, fieldNameLength) - fieldName = StringUtils.stringFromBinary(fieldNameBinary) - - val dimensionBinary = Array.ofDim[Byte](buf.remaining) - buf.get(dimensionBinary) - - baseDefinition = PersistenceUtils.fromBinary(dimensionBinary).asInstanceOf[NumericDimensionDefinition] - } - - override def hashCode: Int = { - val prime = 31 - var result = 1 - result = (prime * result) + (if (baseDefinition == null) 0 else baseDefinition.hashCode) - result = (prime * result) + (if (fieldName == null) 0 else fieldName.hashCode) - result - } - - override def equals(obj: Any): Boolean = { - if (this eq obj.asInstanceOf[AnyRef]) return true - if (obj == null) return false - if (getClass ne obj.getClass) return false - val other = obj.asInstanceOf[ElevationField] - if (baseDefinition == null) if (other.baseDefinition != null) return false - else if (!(baseDefinition == other.baseDefinition)) return false - if (fieldName == null) if (other.fieldName != null) return false - else if (!(fieldName == other.fieldName)) return false - true - } -} - -object ElevationField { - val DEFAULT_FIELD_ID = "default_elevation_dimension" - - def apply(): ElevationField = new ElevationField() - def apply(maxValue: Double): ElevationField = new ElevationField(baseDefinition = new ElevationDefinition(0, maxValue.toInt)) - def apply(maxValue: Int): ElevationField = new ElevationField(baseDefinition = new ElevationDefinition(0, maxValue)) -} diff --git a/geowave/src/main/scala/geotrellis/geowave/index/query/ExplicitSpatialElevationQuery.scala b/geowave/src/main/scala/geotrellis/geowave/index/query/ExplicitSpatialElevationQuery.scala deleted file mode 100644 index f60504eb9f..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/index/query/ExplicitSpatialElevationQuery.scala +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.index.query - -import geotrellis.geowave.index.dimension.ElevationDefinition -import org.locationtech.geowave.core.geotime.store.query.ExplicitSpatialQuery -import org.locationtech.geowave.core.geotime.util.GeometryUtils -import org.locationtech.geowave.core.index.sfc.data.NumericRange -import org.locationtech.geowave.core.store.query.constraints.BasicQueryByClass.{ConstraintData, ConstraintSet, ConstraintsByClass} -import org.locationtech.jts.geom.Geometry - -class ExplicitSpatialElevationQuery(constraints: ConstraintsByClass, geometry: Geometry) extends ExplicitSpatialQuery(constraints, geometry) - -object ExplicitSpatialElevationQuery { - def apply(elevation: Double, queryGeometry: Geometry): ExplicitSpatialElevationQuery = - apply(elevation, elevation, queryGeometry) - - def apply(minElevation: Double, maxElevation: Double, queryGeometry: Geometry): ExplicitSpatialElevationQuery = { - val geoConstraints = GeometryUtils.basicConstraintsFromGeometry(queryGeometry) - - val depthConstraints = new ConstraintsByClass( - new ConstraintSet( - new ConstraintData(new NumericRange(minElevation, maxElevation), false), - classOf[ElevationDefinition] - ) - ) - - new ExplicitSpatialElevationQuery(geoConstraints.merge(depthConstraints), queryGeometry) - } -} diff --git a/geowave/src/main/scala/geotrellis/geowave/index/query/ExplicitSpatialTemporalElevationQuery.scala b/geowave/src/main/scala/geotrellis/geowave/index/query/ExplicitSpatialTemporalElevationQuery.scala deleted file mode 100644 index 5a64aa3194..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/index/query/ExplicitSpatialTemporalElevationQuery.scala +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.index.query - -import java.util.Date - -import geotrellis.geowave.index.dimension.ElevationDefinition -import org.locationtech.geowave.core.geotime.index.dimension.{SimpleTimeDefinition, TimeDefinition} -import org.locationtech.geowave.core.geotime.store.query.ExplicitSpatialQuery -import org.locationtech.geowave.core.geotime.util.GeometryUtils -import org.locationtech.geowave.core.index.sfc.data.NumericRange -import org.locationtech.geowave.core.store.query.constraints.BasicQueryByClass.{ConstraintData, ConstraintSet, ConstraintsByClass} -import org.locationtech.jts.geom.Geometry - -class ExplicitSpatialTemporalElevationQuery(constraints: ConstraintsByClass, geometry: Geometry) extends ExplicitSpatialQuery(constraints, geometry) - -object ExplicitSpatialTemporalElevationQuery { - def apply(depth: Double, startTime: Date, endTime: Date, queryGeometry: Geometry): ExplicitSpatialTemporalElevationQuery = - apply(depth, depth, startTime, endTime, queryGeometry) - - def apply(minElevation: Double, maxElevation: Double, minTime: Date, maxTime: Date, queryGeometry: Geometry): ExplicitSpatialTemporalElevationQuery = { - val geoConstraints = GeometryUtils.basicConstraintsFromGeometry(queryGeometry) - val temporalConstraints = new ConstraintsByClass( - new ConstraintSet( - new ConstraintData(new NumericRange(minTime.getTime.toDouble, maxTime.getTime.toDouble), false), - classOf[TimeDefinition], - classOf[SimpleTimeDefinition] - ) - ) - val depthConstraints = new ConstraintsByClass( - new ConstraintSet( - new ConstraintData(new NumericRange(minElevation, maxElevation), false), - classOf[ElevationDefinition] - ) - ) - - new ExplicitSpatialTemporalElevationQuery(geoConstraints.merge(temporalConstraints).merge(depthConstraints), queryGeometry) - } -} diff --git a/geowave/src/main/scala/geotrellis/geowave/ingest/ConfigureIndex.scala b/geowave/src/main/scala/geotrellis/geowave/ingest/ConfigureIndex.scala deleted file mode 100644 index f347dc0cb7..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/ingest/ConfigureIndex.scala +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.ingest - -import cats.data.Validated.Invalid -import cats.effect.Sync -import geotrellis.geowave.adapter.GeoTrellisDataAdapter -import geotrellis.geowave.dsl._ -import org.locationtech.geowave.core.store.api.Index -import cats.data.Validated.Valid - -object ConfigureIndex { - private final val logger = org.slf4j.LoggerFactory.getLogger(this.getClass()) - - def apply(params: IndexParameters): List[Index] = { - val adapter = GeoTrellisDataAdapter.load(params.dataType, params.typeName) - val indices = params.indices.map { indexDefinition => - val index = indexDefinition.getIndex - adapter.validateIndexCompatability(index) - .leftMap{ msg => - s"'${indexDefinition.indexType}' index type is incompatable with '${adapter.getTypeName}' adapter: $msg" - } - } - val errors = indices.collect { case Invalid(e) => e } - if (errors.nonEmpty) throw new IllegalArgumentException(errors.mkString("; ")) - val validIndeces = indices.collect { case Valid(i) => i} - - // and persist them; so the name is valid for adapter type + a list of indices - params.dataStore.addType(adapter, validIndeces: _*) - logger.info(s"Created index: ${validIndeces.map(_.getName)}") - validIndeces - } - - def applyF[F[_]: Sync](params: IndexParameters): F[List[Index]] = Sync[F].delay(apply(params)) -} diff --git a/geowave/src/main/scala/geotrellis/geowave/ingest/ExecuteQuery.scala b/geowave/src/main/scala/geotrellis/geowave/ingest/ExecuteQuery.scala deleted file mode 100644 index 00c02f52e3..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/ingest/ExecuteQuery.scala +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.ingest - -import cats.effect.Sync -import geotrellis.geowave.dsl._ -import org.locationtech.geowave.core.store.api.Query - -object ExecuteQuery { - def delete(queryConfiguration: QueryConfiguration): Query[_] = { - val query = queryConfiguration.query - queryConfiguration.dataStore.delete(query) - query - } - - def syncDelete[F[_]: Sync](queryConfiguration: QueryConfiguration): F[Query[_]] = Sync[F].delay(delete(queryConfiguration)) -} diff --git a/geowave/src/main/scala/geotrellis/geowave/ingest/IngestGeoTiff.scala b/geowave/src/main/scala/geotrellis/geowave/ingest/IngestGeoTiff.scala deleted file mode 100644 index 888a77289b..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/ingest/IngestGeoTiff.scala +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.ingest - -import java.net.URI - -import cats.effect.{IO, Sync} -import cats.instances.list._ -import cats.syntax.flatMap._ -import cats.syntax.functor._ -import cats.syntax.traverse._ -import geotrellis.geowave.dsl._ -import geotrellis.raster.MultibandTile -import geotrellis.raster.geotiff.GeoTiffRasterSource -import geotrellis.raster.io.geotiff.{GeoTiff, MultibandGeoTiff} -import org.locationtech.geowave.core.store.api.WriteResults -import org.slf4j.LoggerFactory - -object IngestGeoTiff { - private val logger = LoggerFactory.getLogger(this.getClass()) - - def apply(params: IngestParameters[TilingBounds]): List[WriteResults] = - sync[IO](params).unsafeRunSync() - - def sync[F[_]: Sync]( - params: IngestParameters[TilingBounds] - ): F[List[WriteResults]] = { - logger.info(s"Reading: ${params.uri} as ${params.dataType} with ${params.options} options") - val reader = dataTypeReader[F] - val values = reader.read(params.uri, params.options) - - values.map { chunks => - val writer = params.writer[GeoTiff[MultibandTile]] - if (writer == null) throw new RuntimeException(s"No writer for ${params.typeName}") - - try { - val results = chunks.map(writer.write).toList - logger.info(s"Wrote: ${params.uri} to ${params.typeName}") - results - } - finally writer.close() - } - } - - def dataTypeReader[F[_]: Sync]: DataTypeReader[F, TilingBounds, GeoTiff[MultibandTile]] = - new DataTypeReader[F, TilingBounds, GeoTiff[MultibandTile]] { - def read(uri: URI, options: Option[TilingBounds]): F[Iterator[GeoTiff[MultibandTile]]] = - metadata(uri) >>= { - _ - .split(options.getOrElse(TilingBounds())) - .map { md => readVoxelBounds(uri, md.bounds) } - .toList - .sequence - .map(_.iterator.flatten) - } - - private - def readVoxelBounds(uri: URI, bounds: VoxelBounds3D): F[Iterator[GeoTiff[MultibandTile]]] = Sync[F].delay { - val rs = GeoTiffRasterSource(uri.toString) - rs - .read(bounds.toGridBounds.toGridType[Long], bounds.depthMin to bounds.depthMax) - .map(MultibandGeoTiff(_, rs.crs, rs.metadata.tags)) - .iterator - } - - private - def metadata(uri: URI): F[IngestGeoTiffMetadata] = Sync[F].delay { - val rs = GeoTiffRasterSource(uri.toString) - - IngestGeoTiffMetadata( - VoxelDimensions3D(rs.cols.toInt, rs.rows.toInt, rs.bandCount).toVoxelBounds, - rs.extent, - rs.metadata - ) - } - } -} diff --git a/geowave/src/main/scala/geotrellis/geowave/ingest/IngestGeoTiffMetadata.scala b/geowave/src/main/scala/geotrellis/geowave/ingest/IngestGeoTiffMetadata.scala deleted file mode 100644 index 7403724a5c..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/ingest/IngestGeoTiffMetadata.scala +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.ingest - -import geotrellis.geowave.dsl.{Metadata, TilingBounds, VoxelBounds3D, VoxelDimensions3D} -import geotrellis.raster.geotiff.GeoTiffMetadata -import geotrellis.raster.split.Split -import geotrellis.vector.Extent - -case class IngestGeoTiffMetadata( - bounds: VoxelBounds3D, - extent: Extent, - metadata: GeoTiffMetadata -) extends Metadata { - type VoxelBoundsInternal = VoxelBounds3D - - def split(tb: TilingBounds): Seq[IngestGeoTiffMetadata] = split(bounds.toVoxelDimensions.withTilingBounds(tb)) - def split(tb: TilingBounds, options: Split.Options): Seq[IngestGeoTiffMetadata] = split(bounds.toVoxelDimensions.withTilingBounds(tb), options) - def split(dims: VoxelDimensions3D): Seq[IngestGeoTiffMetadata] = split(dims, Split.Options.DEFAULT) - def split(dims: VoxelDimensions3D, options: Split.Options): Seq[IngestGeoTiffMetadata] = { - val mt = mapKeyTransform - bounds - .split(dims, options) - .map { bounds => - if(this.bounds.toGridBounds == bounds.toGridBounds) this.copy(bounds = bounds) - else this.copy(bounds = bounds, extent = mt.boundsToExtent(bounds.toGridBounds)) - } - } -} \ No newline at end of file diff --git a/geowave/src/main/scala/geotrellis/geowave/package.scala b/geowave/src/main/scala/geotrellis/geowave/package.scala deleted file mode 100644 index c0350590a3..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/package.scala +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis - -package object geowave extends Implicits diff --git a/geowave/src/main/scala/geotrellis/geowave/utils/DoubleUtils.scala b/geowave/src/main/scala/geotrellis/geowave/utils/DoubleUtils.scala deleted file mode 100644 index 968c783461..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/utils/DoubleUtils.scala +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.utils - -import java.nio.ByteBuffer - -object DoubleUtils { - val doubleByteLength: Int = 8 - - def toBinary(value: Double): Array[Byte] = ByteBuffer.wrap(Array.ofDim[Byte](doubleByteLength)).putDouble(value).array() - def fromBinary(bytes: Array[Byte]): Double = ByteBuffer.wrap(bytes).getDouble() - def writeDouble(value: Double, buffer: ByteBuffer): Unit = buffer.putDouble(value) - def readDouble(buffer: ByteBuffer): Double = buffer.getDouble -} diff --git a/geowave/src/main/scala/geotrellis/geowave/utils/GeodesicUtils.scala b/geowave/src/main/scala/geotrellis/geowave/utils/GeodesicUtils.scala deleted file mode 100644 index c15eae8b04..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/utils/GeodesicUtils.scala +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.utils - -import geotrellis.vector.Point -import squants.space._ - -object GeodesicUtils { - def pointFromOriginDistanceBearing(originLatLng: Point, distance: Length, bearingAngle: Angle): Point = { - val earthRadius = 6371000 // meters - - val bearingRadians = bearingAngle.toRadians - val latRadians = math.toRadians(originLatLng.getY) - val lngRadians = math.toRadians(originLatLng.getX) - val dMeters = distance.toMeters - - val latRadians2 = - math.asin(math.sin(latRadians) * math.cos(dMeters/earthRadius) + math.cos(latRadians)*math.sin(dMeters/earthRadius)*math.cos(bearingRadians)) - val lngRadians2 = - lngRadians + math.atan2(math.sin(bearingRadians) * math.sin(dMeters/earthRadius) * math.cos(latRadians), - math.cos(dMeters/earthRadius) - math.sin(latRadians) * math.sin(latRadians)) - - Point(math.toDegrees(lngRadians2), math.toDegrees(latRadians2)) - } -} \ No newline at end of file diff --git a/geowave/src/main/scala/geotrellis/geowave/utils/ListUtils.scala b/geowave/src/main/scala/geotrellis/geowave/utils/ListUtils.scala deleted file mode 100644 index 14812f7db2..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/utils/ListUtils.scala +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave.utils - -import java.nio.ByteBuffer - -import org.locationtech.geowave.core.index.{ByteArrayUtils, StringUtils, VarintUtils} - -import scala.collection.mutable.ListBuffer - -object ListUtils { - def stringsToBinary(list: List[String]): Array[Byte] = { - if (list.isEmpty) Array() - else { - val intermediate: Seq[(Int, Array[Byte])] = list.map { e => - val arr = StringUtils.stringToBinary(e) - arr.length -> arr - } - - val byteCount = intermediate.map { case (length, _) => length + VarintUtils.unsignedIntByteLength(length) }.sum - val buf = ByteBuffer.allocate(byteCount) - intermediate.foreach { case (length, arr) => VarintUtils.writeUnsignedInt(length, buf); buf.put(arr) } - buf.array - } - } - - def stringsFromBinary(bytes: Array[Byte]): List[String] = { - if (bytes.isEmpty) Nil - else { - val buf = ByteBuffer.wrap(bytes) - val list = ListBuffer[String]() - - while (buf.hasRemaining) { - val length = VarintUtils.readUnsignedInt(buf) - list += StringUtils.stringFromBinary(ByteArrayUtils.safeRead(buf, length)) - } - - list.toList - } - } -} diff --git a/geowave/src/main/scala/geotrellis/geowave/utils/package.scala b/geowave/src/main/scala/geotrellis/geowave/utils/package.scala deleted file mode 100644 index c8d9eaedb2..0000000000 --- a/geowave/src/main/scala/geotrellis/geowave/utils/package.scala +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2020 Azavea - * - * 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 geotrellis.geowave - -package object utils { - implicit class MapStringOps(val map: Map[String, String]) { - def prefixedList: List[String] = map.toList.flatMap { case (k, v) => List(s"--$k", v) } - } -} diff --git a/geowave/src/test/resources/logback.xml b/geowave/src/test/resources/logback.xml deleted file mode 100644 index 053890d2d2..0000000000 --- a/geowave/src/test/resources/logback.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - %white(%d{HH:mm:ss.SSS}) %highlight(%-5level) %cyan(%logger{50}) - %msg %n - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/geowave/src/test/resources/raster/all-ones.tif b/geowave/src/test/resources/raster/all-ones.tif deleted file mode 100644 index ab2399356444054927d86344538528358dc97529..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7040 zcmebEWzb?^kT}2~z{tSB!oa`)rWhHK*h~z}U~vVYBr}BFunEX!gNg%nFp46vosjf8 zBe7jzY{oD~R~VcB7h^C~FVL1|J_a73T_F3;wKRd*Y(Vz2_Vr*f37}14?Hd`GfMOg# zw%d|MINJ{>#$fO5*SO_{G>motiQxkdiQDEfXI`*4VAv|RBk*+xTrDFg92i(Z0Rm(( zv4D6$F`%VDTHqN6BhVG>Ku3UF$Ee&F?jEdQVN%1OYY7B;1`HLq-X3P;Wnkc8QkWh2 z_9Ac5jTfq+qhK@yMnhmU1V%$(Gz3ONU^E0qLtr!nMnhmU1V%$(Gz3ONV919+ZO!2c zn*|w!fI|h~@e=T03L_Gm)NvFUh+fc01fvs@InGFIlEzeo^blhzLT-pL6`?Z3n2OM{ zB@N&)l`jkoLfe+W$5({bfrdT?%lL|oyNjcbZ)!9sIQVjabj*k4p7cO$MGB z7>XtXnCooxQT@okAWV~#Wdx3G5e5b^0qUeOktv8&Cb9;R%0%uUQkf_ZB9)1XAX1qa zcz|u7QyI~zi(cu3yktyL>Vl128W|W`S{WKz85k-U8d(__01?eoo;V+MQl7XHBISu& zAyS@r79!<|&w`{p;D|MY_##Bglh^?&->~_9P^U)ska!o@fDn&CRjkn=xxz=~kv65wplQ>RfkDa+kv63(hGg1w^>GaY*2MmPz{IHsuh&rP I>JguQ0bcM)_y7O^ diff --git a/geowave/src/test/resources/reference.conf b/geowave/src/test/resources/reference.conf deleted file mode 100644 index 57da84c4c9..0000000000 --- a/geowave/src/test/resources/reference.conf +++ /dev/null @@ -1,13 +0,0 @@ -geotrellis.raster.gdal { - acceptable-datasets = ["SOURCE", "WARPED"] - number-of-attempts = 1048576 -} - -geotrellis.geowave.connection.store { - data-store-type = "cassandra" - options = { - "contactPoints": "localhost", - "contactPoints": ${?CASSANDRA_HOST}, - "gwNamespace" : "geotrellis" - } -} diff --git a/geowave/src/test/scala/geotrellis/geowave/TestEnvironment.scala b/geowave/src/test/scala/geotrellis/geowave/TestEnvironment.scala deleted file mode 100644 index 9c1733e800..0000000000 --- a/geowave/src/test/scala/geotrellis/geowave/TestEnvironment.scala +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2021 Azavea - * - * 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 geotrellis.geowave - -import org.scalatest.funspec.AnyFunSpec - -import scala.util.Properties -import org.locationtech.geowave.core.store.api.DataStore -import org.locationtech.geowave.core.store.api.DataStoreFactory -import org.locationtech.geowave.datastore.cassandra.config.{CassandraOptions, CassandraRequiredOptions} - -class TestEnvironment extends AnyFunSpec { - val kafka: String = Properties.envOrElse("KAFKA_HOST", "localhost:9092") - val cassandra: String = Properties.envOrElse("CASSANDRA_HOST", "localhost") - - def getDataStore(name: String): DataStore = { - DataStoreFactory.createDataStore( - new CassandraRequiredOptions(cassandra, name, - new CassandraOptions())) - } -} diff --git a/geowave/src/test/scala/geotrellis/geowave/adapter/GeoTrellisDataAdapterSPISpec.scala b/geowave/src/test/scala/geotrellis/geowave/adapter/GeoTrellisDataAdapterSPISpec.scala deleted file mode 100644 index 1b90467b54..0000000000 --- a/geowave/src/test/scala/geotrellis/geowave/adapter/GeoTrellisDataAdapterSPISpec.scala +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2021 Azavea - * - * 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 geotrellis.geowave.adapter - -import geotrellis.geowave.dsl.syntax._ -import geotrellis.geowave.adapter.geotiff._ - -import geotrellis.raster.MultibandTile -import geotrellis.raster.io.geotiff.GeoTiff -import org.scalatest.funspec.AnyFunSpec -import org.scalatest.matchers.should.Matchers - -class GeoTrellisDataAdapterSPISpec extends AnyFunSpec with Matchers { - describe("GeoTrellisDataAdapterSPISpec") { - it("should create a GeoTiffAdapter") { - val typeName = "TestGeoTiff".typeName - - val actual = GeoTrellisDataAdapter.load(DataTypeGeoTiff, typeName).asInstanceOf[GeoTiffAdapter] - val expected = new GeoTiffAdapter(typeName) - - actual.getClass shouldBe expected.getClass - actual.getTypeName shouldBe expected.getTypeName - actual.getFieldHandlers.map { _.getFieldName } shouldBe expected.getFieldHandlers.map { _.getFieldName } - actual.toBinary should contain theSameElementsAs expected.toBinary - } - - it("should not create Adapters for non implemented types") { - intercept[RuntimeException] { GeoTrellisDataAdapter.load("NewDataType".dataType, "NewTypeName".typeName) } - } - } -} diff --git a/geowave/src/test/scala/geotrellis/geowave/adapter/geotiff/GeoTiffAdapterSpec.scala b/geowave/src/test/scala/geotrellis/geowave/adapter/geotiff/GeoTiffAdapterSpec.scala deleted file mode 100644 index 9df2b5a732..0000000000 --- a/geowave/src/test/scala/geotrellis/geowave/adapter/geotiff/GeoTiffAdapterSpec.scala +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright 2021 Azavea - * - * 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 geotrellis.geowave.adapter.geotiff - -import geotrellis.geowave.dsl.syntax._ -import geotrellis.geowave.api.SQueryBuilder -import geotrellis.raster.MultibandTile -import geotrellis.raster.io.geotiff.{GeoTiff, MultibandGeoTiff} -import geotrellis.vector.Extent -import org.locationtech.geowave.core.geotime.index.api.SpatialIndexBuilder -import org.locationtech.geowave.core.geotime.store.query.ExplicitSpatialQuery -import org.locationtech.geowave.core.store.CloseableIterator -import org.locationtech.geowave.core.store.api.{DataStore, DataStoreFactory, Writer} -import org.locationtech.geowave.datastore.cassandra.config.{CassandraOptions, CassandraRequiredOptions} - -import geotrellis.geowave.TestEnvironment -import org.scalatest.matchers.should.Matchers - -class GeoTiffAdapterSpec extends TestEnvironment with Matchers { - lazy val uri: String = "src/test/resources/raster/all-ones.tif" - - describe("GeoTiffAdapterSpec spatial index spec") { - // This describes how to index the data - val index = new SpatialIndexBuilder().createIndex - - // Register our adapter in a datastore - lazy val geowaveDataStore: DataStore = DataStoreFactory.createDataStore(new CassandraRequiredOptions(cassandra, "GeoTiffAdapterSpec", new CassandraOptions())) - lazy val tiff = MultibandGeoTiff(uri) - lazy val dataTypeAdapter = new GeoTiffAdapter("GeoTiffAdapterSpec".typeName) - geowaveDataStore.addType(dataTypeAdapter, index) - - it("should write spatially indexed GeoTiff") { - val indexWriter: Writer[GeoTiff[MultibandTile]] = geowaveDataStore.createWriter(dataTypeAdapter.getTypeName) - try indexWriter.write(tiff) finally { - if (indexWriter != null) indexWriter.close() - } - } - - it("should query the entire contents of a store") { - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe true - val actualTiff = it.next() - actualTiff.toByteArray should contain theSameElementsAs tiff.toByteArray - it.hasNext shouldBe false - } - - it("should query store by extent") { - val extent = tiff.extent - val spatialQuery = new ExplicitSpatialQuery(extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialQuery) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe true - val actualTiff = it.next() - - actualTiff.toByteArray should contain theSameElementsAs tiff.toByteArray - it.hasNext shouldBe false - } - - it("should return nothing querying out of the tiff bounds") { - val extent = Extent(0, 0, 1, 1) - val spatialQuery = new ExplicitSpatialQuery(extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialQuery) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe false - } - - it("should delete nothing by the query out of bounds") { - val extent = Extent(0, 0, 1, 1) - val spatialQuery = new ExplicitSpatialQuery(extent.toPolygon()) - - val dquery = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialQuery) - - geowaveDataStore.delete(dquery.build()) shouldBe true - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe true - } - - it("should delete everything by the query") { - val extent = tiff.extent - val spatialQuery = new ExplicitSpatialQuery(extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialQuery) - - geowaveDataStore.delete(query.build()) shouldBe true - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe false - } - } - - describe("GeoTiffAdapterSpec serialization spec") { - it("should be serialized properly") { - val expected = new GeoTiffAdapter("MultibandGeoTiffDataAdapterSpec".typeName) - val actual = new GeoTiffAdapter() - - actual.fromBinary(expected.toBinary) - - actual.getTypeName shouldBe expected.getTypeName - actual.getFieldHandlers.map { _.getFieldName } shouldBe expected.getFieldHandlers.map { _.getFieldName } - } - } -} diff --git a/geowave/src/test/scala/geotrellis/geowave/adapter/geotiff/IMMultibandGeoTiffAdapterSpec.scala b/geowave/src/test/scala/geotrellis/geowave/adapter/geotiff/IMMultibandGeoTiffAdapterSpec.scala deleted file mode 100644 index 1317f6287e..0000000000 --- a/geowave/src/test/scala/geotrellis/geowave/adapter/geotiff/IMMultibandGeoTiffAdapterSpec.scala +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright 2021 Azavea - * - * 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 geotrellis.geowave.adapter.geotiff - -import geotrellis.geowave.dsl.syntax._ -import geotrellis.geowave.api.SQueryBuilder -import geotrellis.geowave.api.SQueryBuilder -import geotrellis.raster.MultibandTile -import geotrellis.raster.io.geotiff.{GeoTiff, MultibandGeoTiff} -import geotrellis.vector.Extent -import org.locationtech.geowave.core.geotime.index.api.SpatialIndexBuilder -import org.locationtech.geowave.core.geotime.store.query.ExplicitSpatialQuery -import org.locationtech.geowave.core.store.CloseableIterator -import org.locationtech.geowave.core.store.api.{DataStore, DataStoreFactory, Writer} -import org.locationtech.geowave.core.store.memory.MemoryRequiredOptions -import org.scalatest.funspec.AnyFunSpec -import org.scalatest.matchers.should.Matchers - -/** In memory data store is not threadsafe, for these reasons it is ignored, but it is a pretty convenient for local development. */ -class IMGeoTiffAdapterSpec extends AnyFunSpec with Matchers { - lazy val uri: String = "src/test/resources/raster/all-ones.tif" - - /** To run this test change "ignore" to "describe" */ - ignore("In Memory GeoTiffAdapterSpec spatial index spec") { - // This describes how to index the data - val index = new SpatialIndexBuilder().createIndex - - // Register our adapter in a datastore - lazy val geowaveDataStore: DataStore = DataStoreFactory.createDataStore(new MemoryRequiredOptions) - lazy val tiff = MultibandGeoTiff(uri) - lazy val dataTypeAdapter = new GeoTiffAdapter("MultibandGeoTiffDataAdapterSpec".typeName) - geowaveDataStore.addType(dataTypeAdapter, index) - - it("should write spatially indexed GeoTiff") { - val indexWriter: Writer[GeoTiff[MultibandTile]] = geowaveDataStore.createWriter(dataTypeAdapter.getTypeName) - try indexWriter.write(tiff) finally { - if (indexWriter != null) indexWriter.close() - } - } - - it("should query the entire contents of a store") { - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe true - val actualTiff = it.next() - actualTiff.toByteArray should contain theSameElementsAs tiff.toByteArray - it.hasNext shouldBe false - } - - it("should query store by extent") { - val extent = tiff.extent - val spatialQuery = new ExplicitSpatialQuery(extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialQuery) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe true - val actualTiff = it.next() - - actualTiff.toByteArray should contain theSameElementsAs tiff.toByteArray - it.hasNext shouldBe false - } - - it("should return nothing querying out of bounds") { - val extent = Extent(0, 0, 1, 1) - val spatialQuery = new ExplicitSpatialQuery(extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialQuery) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe false - } - - it("should delete nothing by the query out of bounds") { - val extent = Extent(0, 0, 1, 1) - val spatialQuery = new ExplicitSpatialQuery(extent.toPolygon()) - - val dquery = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialQuery) - - geowaveDataStore.delete(dquery.build()) shouldBe true - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe true - } - - it("should delete everything by the query") { - val extent = tiff.extent - val spatialQuery = new ExplicitSpatialQuery(extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialQuery) - - geowaveDataStore.delete(query.build()) shouldBe true - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe false - } - } - - describe("GeoTiffAdapterSpec serialization spec") { - it("should be serialized properly") { - val expected = new GeoTiffAdapter("MultibandGeoTiffDataAdapterSpec".typeName) - val actual = new GeoTiffAdapter() - - actual.fromBinary(expected.toBinary) - - actual.getTypeName shouldBe expected.getTypeName - actual.getFieldHandlers.map { _.getFieldName } shouldBe expected.getFieldHandlers.map { _.getFieldName } - } - } -} diff --git a/geowave/src/test/scala/geotrellis/geowave/adapter/geotiff/SpatialTemporalElevationGeoTiffAdapterSpec.scala b/geowave/src/test/scala/geotrellis/geowave/adapter/geotiff/SpatialTemporalElevationGeoTiffAdapterSpec.scala deleted file mode 100644 index bf125cfe31..0000000000 --- a/geowave/src/test/scala/geotrellis/geowave/adapter/geotiff/SpatialTemporalElevationGeoTiffAdapterSpec.scala +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright 2021 Azavea - * - * 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 geotrellis.geowave.adapter.geotiff - -import geotrellis.geowave.dsl.syntax._ -import geotrellis.geowave.adapter.geotiff.GeoTiffAdapter.GEOTIFF_TIME_FORMATTER_DEFAULT -import geotrellis.geowave.index.SpatialTemporalElevationIndexBuilder -import geotrellis.geowave.api.SQueryBuilder -import geotrellis.geowave.index.query.ExplicitSpatialTemporalElevationQuery -import geotrellis.raster.MultibandTile -import geotrellis.raster.io.geotiff.{GeoTiff, MultibandGeoTiff} -import geotrellis.vector.Extent - -import org.locationtech.geowave.core.geotime.store.query.{ExplicitSpatialQuery, ExplicitSpatialTemporalQuery} -import org.locationtech.geowave.core.store.CloseableIterator -import org.locationtech.geowave.core.store.api.{DataStore, DataStoreFactory, Writer} -import org.locationtech.geowave.datastore.cassandra.config.{CassandraOptions, CassandraRequiredOptions} - -import java.time.ZonedDateTime -import java.util.Date - -import geotrellis.geowave.TestEnvironment -import org.scalatest.matchers.should.Matchers - -class SpatialTemporalElevationGeoTiffAdapterSpec extends TestEnvironment with Matchers { - lazy val uri: String = "src/test/resources/raster/all-ones.tif" - - describe("STDGeoTiffAdapterSpec spatial temporal elevation index spec") { - // This describes how to index the data - val index = new SpatialTemporalElevationIndexBuilder().createIndex - - // Register our adapter in a datastore - lazy val geowaveDataStore: DataStore = DataStoreFactory.createDataStore(new CassandraRequiredOptions(cassandra, "STDGeoTiffAdapterSpec", new CassandraOptions())) - lazy val tiff = MultibandGeoTiff(uri) - lazy val dataTypeAdapter = new GeoTiffAdapter("STDGeoTiffAdapterSpec".typeName) - geowaveDataStore.addType(dataTypeAdapter, index) - - it("should write indexed GeoTiff") { - val indexWriter: Writer[GeoTiff[MultibandTile]] = geowaveDataStore.createWriter(dataTypeAdapter.getTypeName) - try indexWriter.write(tiff) finally { - if (indexWriter != null) indexWriter.close() - } - } - - it("should query the entire contents of a store") { - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe true - val actualTiff = it.next() - actualTiff.toByteArray should contain theSameElementsAs tiff.toByteArray - it.hasNext shouldBe false - } - - it("should query store by extent") { - val extent = tiff.extent - val spatialQuery = new ExplicitSpatialQuery(extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialQuery) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe true - val actualTiff = it.next() - - actualTiff.toByteArray should contain theSameElementsAs tiff.toByteArray - it.hasNext shouldBe false - } - - it("should query store by time") { - val extent = tiff.extent - val dateString = "2019:11:01 12:00:00" - val date = Date.from(ZonedDateTime.from(GEOTIFF_TIME_FORMATTER_DEFAULT.parse(dateString)).toInstant) - val spatialTemporalQuery = new ExplicitSpatialTemporalQuery(date, date, extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialTemporalQuery) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe true - val actualTiff = it.next() - - actualTiff.toByteArray should contain theSameElementsAs tiff.toByteArray - it.hasNext shouldBe false - } - - it("should query store by elevation") { - val extent = tiff.extent - val dateString = "2019:11:01 12:00:00" - val date = Date.from(ZonedDateTime.from(GEOTIFF_TIME_FORMATTER_DEFAULT.parse(dateString)).toInstant) - val stdQuery = ExplicitSpatialTemporalElevationQuery(1, date, date, extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(stdQuery) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe true - val actualTiff = it.next() - - actualTiff.toByteArray should contain theSameElementsAs tiff.toByteArray - it.hasNext shouldBe false - } - - it("should return nothing querying out of the spatial tiff bounds") { - val extent = Extent(0, 0, 1, 1) - val dateString = "2019:11:01 12:00:00" - val date = Date.from(ZonedDateTime.from(GEOTIFF_TIME_FORMATTER_DEFAULT.parse(dateString)).toInstant) - val spatialTemporalQuery = new ExplicitSpatialTemporalQuery(date, date, extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialTemporalQuery) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe false - } - - it("should return nothing querying out of the temporal bounds") { - val extent = tiff.extent - val dateString = "2017:11:01 12:00:00" - val date = Date.from(ZonedDateTime.from(GEOTIFF_TIME_FORMATTER_DEFAULT.parse(dateString)).toInstant) - val spatialTemporalQuery = new ExplicitSpatialTemporalQuery(date, date, extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialTemporalQuery) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe false - } - - it("should query nothing out of the elevation bounds") { - val extent = tiff.extent - val dateString = "2019:11:01 12:00:00" - val date = Date.from(ZonedDateTime.from(GEOTIFF_TIME_FORMATTER_DEFAULT.parse(dateString)).toInstant) - val stdQuery = ExplicitSpatialTemporalElevationQuery(100, date, date, extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(stdQuery) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe false - } - - it("should return nothing querying out of the spatialtemporal bounds") { - val extent = Extent(0, 0, 1, 1) - val dateString = "2017:11:01 12:00:00" - val date = Date.from(ZonedDateTime.from(GEOTIFF_TIME_FORMATTER_DEFAULT.parse(dateString)).toInstant) - val spatialTemporalQuery = new ExplicitSpatialTemporalQuery(date, date, extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialTemporalQuery) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe false - } - - it("should delete nothing by the query out of bounds") { - val extent = Extent(0, 0, 1, 1) - val dateString = "2017:11:01 12:00:00" - val date = Date.from(ZonedDateTime.from(GEOTIFF_TIME_FORMATTER_DEFAULT.parse(dateString)).toInstant) - val spatialTemporalQuery = new ExplicitSpatialTemporalQuery(date, date, extent.toPolygon()) - - val dquery = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialTemporalQuery) - - geowaveDataStore.delete(dquery.build()) shouldBe true - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe true - } - - it("should delete everything by the query") { - val extent = tiff.extent - val dateString = "2019:11:01 12:00:00" - val date = Date.from(ZonedDateTime.from(GEOTIFF_TIME_FORMATTER_DEFAULT.parse(dateString)).toInstant) - val stdQuery = ExplicitSpatialTemporalElevationQuery(1, date, date, extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(stdQuery) - - geowaveDataStore.delete(query.build()) shouldBe true - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe false - } - } -} diff --git a/geowave/src/test/scala/geotrellis/geowave/adapter/geotiff/SpatialTemporalGeoTiffAdapterSpec.scala b/geowave/src/test/scala/geotrellis/geowave/adapter/geotiff/SpatialTemporalGeoTiffAdapterSpec.scala deleted file mode 100644 index ff1cbb5d3e..0000000000 --- a/geowave/src/test/scala/geotrellis/geowave/adapter/geotiff/SpatialTemporalGeoTiffAdapterSpec.scala +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright 2021 Azavea - * - * 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 geotrellis.geowave.adapter.geotiff - -import geotrellis.geowave.dsl.syntax._ -import geotrellis.geowave.adapter.geotiff.GeoTiffAdapter.GEOTIFF_TIME_FORMATTER_DEFAULT -import geotrellis.geowave.api.SQueryBuilder -import geotrellis.raster.MultibandTile -import geotrellis.raster.io.geotiff.{GeoTiff, MultibandGeoTiff} -import geotrellis.vector.Extent -import org.locationtech.geowave.core.geotime.index.api.{SpatialIndexBuilder, SpatialTemporalIndexBuilder} -import org.locationtech.geowave.core.geotime.store.query.{ExplicitSpatialQuery, ExplicitSpatialTemporalQuery} -import org.locationtech.geowave.core.store.CloseableIterator -import org.locationtech.geowave.core.store.api.{DataStore, DataStoreFactory, Writer} -import org.locationtech.geowave.datastore.cassandra.config.{CassandraOptions, CassandraRequiredOptions} -import java.time.ZonedDateTime -import java.util.Date - -import geotrellis.geowave.TestEnvironment -import geotrellis.geowave.api.SQueryBuilder -import org.scalatest.matchers.should.Matchers - -class SpatialTemporalGeoTiffAdapterSpec extends TestEnvironment with Matchers { - lazy val uri: String = "src/test/resources/raster/all-ones.tif" - - describe("SpatialTemporalGeoTiffAdapterSpec spatial temporal index spec") { - // This describes how to index the data - val index = new SpatialTemporalIndexBuilder().createIndex - - // Register our adapter in a datastore - lazy val geowaveDataStore: DataStore = DataStoreFactory.createDataStore(new CassandraRequiredOptions(cassandra, "SpatialTemporalGeoTiffAdapterSpec", new CassandraOptions())) - lazy val tiff = MultibandGeoTiff(uri) - lazy val dataTypeAdapter = new GeoTiffAdapter("SpatialTemporalGeoTiffAdapterSpec".typeName) - geowaveDataStore.addType(dataTypeAdapter, index) - - it("should write spatially temporal indexed GeoTiff") { - val indexWriter: Writer[GeoTiff[MultibandTile]] = geowaveDataStore.createWriter(dataTypeAdapter.getTypeName) - try indexWriter.write(tiff) finally { - if (indexWriter != null) indexWriter.close() - } - } - - it("should query the entire contents of a store") { - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe true - val actualTiff = it.next() - actualTiff.toByteArray should contain theSameElementsAs tiff.toByteArray - it.hasNext shouldBe false - } - - it("should query store by extent") { - val extent = tiff.extent - val spatialQuery = new ExplicitSpatialQuery(extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialQuery) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe true - val actualTiff = it.next() - - actualTiff.toByteArray should contain theSameElementsAs tiff.toByteArray - it.hasNext shouldBe false - } - - it("should query store by time") { - val extent = tiff.extent - val dateString = "2019:11:01 12:00:00" - val date = Date.from(ZonedDateTime.from(GEOTIFF_TIME_FORMATTER_DEFAULT.parse(dateString)).toInstant) - val spatialTemporalQuery = new ExplicitSpatialTemporalQuery(date, date, extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialTemporalQuery) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe true - val actualTiff = it.next() - - actualTiff.toByteArray should contain theSameElementsAs tiff.toByteArray - it.hasNext shouldBe false - } - - it("should return nothing querying out of the spatial tiff bounds") { - val extent = Extent(0, 0, 1, 1) - val dateString = "2019:11:01 12:00:00" - val date = Date.from(ZonedDateTime.from(GEOTIFF_TIME_FORMATTER_DEFAULT.parse(dateString)).toInstant) - val spatialTemporalQuery = new ExplicitSpatialTemporalQuery(date, date, extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialTemporalQuery) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe false - } - - it("should return nothing querying out of the temporal bounds") { - val extent = tiff.extent - val dateString = "2017:11:01 12:00:00" - val date = Date.from(ZonedDateTime.from(GEOTIFF_TIME_FORMATTER_DEFAULT.parse(dateString)).toInstant) - val spatialTemporalQuery = new ExplicitSpatialTemporalQuery(date, date, extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialTemporalQuery) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe false - } - - it("should return nothing querying out of bounds") { - val extent = Extent(0, 0, 1, 1) - val dateString = "2017:11:01 12:00:00" - val date = Date.from(ZonedDateTime.from(GEOTIFF_TIME_FORMATTER_DEFAULT.parse(dateString)).toInstant) - val spatialTemporalQuery = new ExplicitSpatialTemporalQuery(date, date, extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialTemporalQuery) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe false - } - - it("should delete nothing by the query out of bounds") { - val extent = Extent(0, 0, 1, 1) - val dateString = "2017:11:01 12:00:00" - val date = Date.from(ZonedDateTime.from(GEOTIFF_TIME_FORMATTER_DEFAULT.parse(dateString)).toInstant) - val spatialTemporalQuery = new ExplicitSpatialTemporalQuery(date, date, extent.toPolygon()) - - val dquery = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialTemporalQuery) - - geowaveDataStore.delete(dquery.build()) shouldBe true - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe true - } - - it("should delete everything by the query") { - val extent = tiff.extent - val dateString = "2019:11:01 12:00:00" - val date = Date.from(ZonedDateTime.from(GEOTIFF_TIME_FORMATTER_DEFAULT.parse(dateString)).toInstant) - val spatialTemporalQuery = new ExplicitSpatialTemporalQuery(date, date, extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialTemporalQuery) - - geowaveDataStore.delete(query.build()) shouldBe true - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe false - } - } -} diff --git a/geowave/src/test/scala/geotrellis/geowave/adapter/raster/IMMultibandRasterAdapterSpec.scala b/geowave/src/test/scala/geotrellis/geowave/adapter/raster/IMMultibandRasterAdapterSpec.scala deleted file mode 100644 index e9306648a1..0000000000 --- a/geowave/src/test/scala/geotrellis/geowave/adapter/raster/IMMultibandRasterAdapterSpec.scala +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright 2021 Azavea - * - * 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 geotrellis.geowave.adapter.raster - -import geotrellis.geowave.dsl.syntax._ -import geotrellis.geowave.api.SQueryBuilder -import geotrellis.geowave.api.SQueryBuilder -import geotrellis.raster.io.geotiff.MultibandGeoTiff -import geotrellis.raster.{MultibandTile, Raster} -import geotrellis.vector.Extent -import org.locationtech.geowave.core.geotime.index.api.SpatialIndexBuilder -import org.locationtech.geowave.core.geotime.store.query.ExplicitSpatialQuery -import org.locationtech.geowave.core.store.CloseableIterator -import org.locationtech.geowave.core.store.api.{DataStore, DataStoreFactory, Writer} -import org.locationtech.geowave.core.store.memory.MemoryRequiredOptions -import org.scalatest.funspec.AnyFunSpec -import org.scalatest.matchers.should.Matchers - -/** In memory data store is not threadsafe, for these reasons it is ignored, but it is a pretty convenient for local development. */ -class IMMultibandRasterAdapterSpec extends AnyFunSpec with Matchers { - lazy val uri: String = "src/test/resources/raster/all-ones.tif" - - /** To run this test change "ignore" to "describe" */ - ignore("In Memory MultibandRasterAdapterSpec spatial index spec") { - // This describes how to index the data - val index = new SpatialIndexBuilder().createIndex - - // Register our adapter in a datastore - lazy val geowaveDataStore: DataStore = DataStoreFactory.createDataStore(new MemoryRequiredOptions) - lazy val raster = MultibandGeoTiff(uri).raster - lazy val dataTypeAdapter = new MulitbandRasterAdapter("MultibandRasterDataAdapterSpec".typeName) - geowaveDataStore.addType(dataTypeAdapter, index) - - it("should write spatially indexed Raster") { - val indexWriter: Writer[Raster[MultibandTile]] = geowaveDataStore.createWriter(dataTypeAdapter.getTypeName) - try indexWriter.write(raster) finally { - if (indexWriter != null) indexWriter.close() - } - } - - it("should query the entire contents of a store") { - val query = - SQueryBuilder - .newBuilder[Raster[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - - val it: CloseableIterator[Raster[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe true - val actualRaster = it.next() - assert(actualRaster == raster) - it.hasNext shouldBe false - } - - it("should query store by extent") { - val extent = raster.extent - val spatialQuery = new ExplicitSpatialQuery(extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[Raster[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialQuery) - - val it: CloseableIterator[Raster[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe true - val actualRaster = it.next() - assert(actualRaster == raster) - it.hasNext shouldBe false - } - - it("should return nothing querying out of the tiff bounds") { - val extent = Extent(0, 0, 1, 1) - val spatialQuery = new ExplicitSpatialQuery(extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[Raster[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialQuery) - - val it: CloseableIterator[Raster[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe false - } - - it("should delete nothing by the query out of bounds") { - val extent = Extent(0, 0, 1, 1) - val spatialQuery = new ExplicitSpatialQuery(extent.toPolygon()) - - val dquery = - SQueryBuilder - .newBuilder[Raster[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialQuery) - - geowaveDataStore.delete(dquery.build()) shouldBe true - - val query = - SQueryBuilder - .newBuilder[Raster[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - - val it: CloseableIterator[Raster[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe true - } - - it("should delete everything by the query") { - val extent = raster.extent - val spatialQuery = new ExplicitSpatialQuery(extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[Raster[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialQuery) - - geowaveDataStore.delete(query.build()) shouldBe true - - val it: CloseableIterator[Raster[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe false - } - } - - describe("MultibandRasterAdapterSpec serialization spec") { - it("should be serialized properly") { - val expected = new MulitbandRasterAdapter("MultibandRasterDataAdapterSpec".typeName) - val actual = new MulitbandRasterAdapter() - - actual.fromBinary(expected.toBinary) - - actual.getTypeName shouldBe expected.getTypeName - actual.getFieldHandlers.map { _.getFieldName } shouldBe expected.getFieldHandlers.map { _.getFieldName } - } - } -} diff --git a/geowave/src/test/scala/geotrellis/geowave/adapter/raster/MultibandRasterAdapterSpec.scala b/geowave/src/test/scala/geotrellis/geowave/adapter/raster/MultibandRasterAdapterSpec.scala deleted file mode 100644 index 3433ff827c..0000000000 --- a/geowave/src/test/scala/geotrellis/geowave/adapter/raster/MultibandRasterAdapterSpec.scala +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright 2021 Azavea - * - * 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 geotrellis.geowave.adapter.raster - -import geotrellis.geowave.dsl.syntax._ -import geotrellis.geowave.api.SQueryBuilder -import geotrellis.raster.io.geotiff.MultibandGeoTiff -import geotrellis.raster.{MultibandTile, Raster} -import geotrellis.raster.testkit.RasterMatchers -import geotrellis.vector.Extent -import org.locationtech.geowave.core.geotime.index.api.SpatialIndexBuilder -import org.locationtech.geowave.core.geotime.store.query.ExplicitSpatialQuery -import org.locationtech.geowave.core.store.CloseableIterator -import org.locationtech.geowave.core.store.api.{DataStore, DataStoreFactory, Writer} -import org.locationtech.geowave.datastore.cassandra.config.{CassandraOptions, CassandraRequiredOptions} -import geotrellis.geowave.TestEnvironment -import geotrellis.geowave.api.SQueryBuilder -import org.scalatest.matchers.should.Matchers - -class MultibandRasterAdapterSpec extends TestEnvironment with RasterMatchers with Matchers { - lazy val uri: String = "src/test/resources/raster/all-ones.tif" - - describe("MultibandRasterAdapterSpec spatial index spec") { - // This describes how to index the data - val index = new SpatialIndexBuilder().createIndex - - // Register our adapter in a datastore - lazy val geowaveDataStore: DataStore = DataStoreFactory.createDataStore(new CassandraRequiredOptions(cassandra, "MultibandRasterAdapterSpec", new CassandraOptions())) - lazy val raster = MultibandGeoTiff(uri).raster - lazy val dataTypeAdapter = new MulitbandRasterAdapter("MultibandRasterAdapterSpec".typeName) - geowaveDataStore.addType(dataTypeAdapter, index) - - it("should write spatially indexed Raster") { - val indexWriter: Writer[Raster[MultibandTile]] = geowaveDataStore.createWriter(dataTypeAdapter.getTypeName) - try indexWriter.write(raster) finally { - if (indexWriter != null) indexWriter.close() - } - } - - it("should query the entire contents of a store") { - val query = - SQueryBuilder - .newBuilder[Raster[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - - val it: CloseableIterator[Raster[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe true - val actualRaster = it.next() - assertEqual(actualRaster, raster) - it.hasNext shouldBe false - } - - it("should query store by extent") { - val extent = raster.extent - val spatialQuery = new ExplicitSpatialQuery(extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[Raster[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialQuery) - - val it: CloseableIterator[Raster[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe true - val actualRaster = it.next() - assertEqual(actualRaster, raster) - it.hasNext shouldBe false - } - - it("should return nothing querying out of the tiff bounds") { - val extent = Extent(0, 0, 1, 1) - val spatialQuery = new ExplicitSpatialQuery(extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[Raster[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialQuery) - - val it: CloseableIterator[Raster[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe false - } - - it("should delete nothing by the query out of bounds") { - val extent = Extent(0, 0, 1, 1) - val spatialQuery = new ExplicitSpatialQuery(extent.toPolygon()) - - val dquery = - SQueryBuilder - .newBuilder[Raster[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialQuery) - - geowaveDataStore.delete(dquery.build()) shouldBe true - - val query = - SQueryBuilder - .newBuilder[Raster[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - - val it: CloseableIterator[Raster[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe true - } - - it("should delete everything by the query") { - val extent = raster.extent - val spatialQuery = new ExplicitSpatialQuery(extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[Raster[MultibandTile]] - .addTypeName(dataTypeAdapter.getTypeName) - .indexName(index.getName) - .constraints(spatialQuery) - - geowaveDataStore.delete(query.build()) shouldBe true - - val it: CloseableIterator[Raster[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe false - } - } - - describe("MultibandRasterAdapterSpec serialization spec") { - it("should be serialized properly") { - val expected = new MulitbandRasterAdapter("MultibandRasterAdapterSpec".typeName) - val actual = new MulitbandRasterAdapter() - - actual.fromBinary(expected.toBinary) - - actual.getTypeName shouldBe expected.getTypeName - actual.getFieldHandlers.map { _.getFieldName } shouldBe expected.getFieldHandlers.map { _.getFieldName } - } - } -} diff --git a/geowave/src/test/scala/geotrellis/geowave/dsl/MessagesSpec.scala b/geowave/src/test/scala/geotrellis/geowave/dsl/MessagesSpec.scala deleted file mode 100644 index 4795d897fd..0000000000 --- a/geowave/src/test/scala/geotrellis/geowave/dsl/MessagesSpec.scala +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright 2021 Azavea - * - * 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 geotrellis.geowave.dsl - -import geotrellis.geowave.dsl.syntax._ -import geotrellis.geowave.adapter.geotiff.GeoTiffAdapter.GEOTIFF_TIME_FORMATTER_DEFAULT -import geotrellis.geowave.dsl.json.{JsonValidator, JsonValidatorErrors} - -import cats.syntax.option._ -import io.circe.syntax._ -import org.locationtech.geowave.core.index.sfc.data.NumericRange -import org.locationtech.geowave.core.geotime.store.dimension.Time.TimeRange -import org.locationtech.geowave.core.store.query.filter.BasicQueryFilter -import geotrellis.vector._ - -import java.net.URI -import java.time.ZonedDateTime - -import org.scalatest.funspec.AnyFunSpec -import org.scalatest.matchers.should.Matchers -import _root_.io.circe.JsonObject -import _root_.io.circe.Codec - -class MessagesSpec extends AnyFunSpec with Matchers { - describe("MessagesSpec") { - - it("should build GeoTiff ingest and index messages") { - val ingestParameters = IngestParameters[TilingBounds]( - typeName = "GeoTiffTest".typeName, - dataType = "GeoTiff".dataType, - uri = new URI("file://path/to/file"), - options = TilingBounds(depth = 1.some).some, - namespace = "GeoTiffTestMessagesSpec".some - ) - - val indexParameters = IndexParameters( - indices = IndexDefinition( - indexName = None, - indexType = "spatial-temporal-depth".indexType, - indexOptions = Map("periodTemporal" -> "Year", "maxDepth" -> "100") - ), - // should be used in the ingest message as a name to create an instance of adapter with a proper index - typeName = "GeoTiffTest".typeName, - dataType = "GeoTiff".dataType, - namespace = "GeoTiffTestMessagesSpec".some - ) - ingestParameters.asJson shouldBe JsonValidator.parseUnsafe[IngestParameters[TilingBounds]](ingestParameters.asJson.spaces4).asJson - indexParameters.asJson shouldBe JsonValidator.parseUnsafe[IndexParameters](indexParameters.asJson.spaces4).asJson - } - - it("should not build uingest and index messages for the unsupported type") { - val exception = intercept[JsonValidatorErrors] { - val ingestParameters = IngestParameters[TilingBounds]( - typeName = "NewTest".typeName, - dataType = "New".dataType, - uri = new URI("file://path/to/file"), - options = TilingBounds( - depth = 1.some, - spissitude = 1.some - ).some, - namespace = "NewTestMessagesSpec".some - ) - - val indexParameters = IndexParameters( - indices = IndexDefinition( - indexName = None, - indexType = "spatial-temporal-depth".indexType, - indexOptions = Map("periodTemporal" -> "Year", "maxDepth" -> "100") - ), - // should be used in the ingest message as a name to create an instance of adapter with a proper index - typeName = "NewTest".typeName, - dataType = "New".dataType, - namespace = "NewTestMessagesSpec".some - ) - - ingestParameters.asJson shouldBe JsonValidator.parseUnsafe[IngestParameters[String]](ingestParameters.asJson.spaces4).asJson - indexParameters.asJson shouldBe JsonValidator.parseUnsafe[IndexParameters](indexParameters.asJson.spaces4).asJson - } - - exception.getMessage shouldBe "Invalid DataType: New; available DataTypes: GeoTiff: DownField(dataType)" - } - } - - it("should parse delete message") { - val deleteExpected = """ - |{ - | "typeName" : "DeleteTest", - | "indexName": "TestIndex", - | "geometry" : { - | "type" : "Point", - | "coordinates" : [ - | 1.0, - | 1.0 - | ] - | }, - | "namespace" : "testnamesapce", - | "time" : { - | "min" : "1970-01-01T00:00:00Z", - | "max" : "2019-11-01T12:00:00Z" - | }, - | "elevation" : { - | "min" : 0.0, - | "max" : 30000.0 - | }, - | "compareOp" : "INTERSECTS" - |} - |""".stripMargin - - - val date = ZonedDateTime.from(GEOTIFF_TIME_FORMATTER_DEFAULT.parse("2019:11:01 12:00:00")).toInstant - - val deleteParameters = DeleteParameters( - typeName = "DeleteTest".typeName, - indexName = "TestIndex", - geometry = Point(1, 1).some, - namespace = "testnamesapce".some, - time = new TimeRange(0, date.toEpochMilli).some, - elevation = new NumericRange(0d, 30000d).some, - compareOp = BasicQueryFilter.BasicQueryCompareOperation.INTERSECTS - ) - - deleteParameters.asJson shouldBe JsonValidator.parseUnsafe[DeleteParameters](deleteExpected).asJson - } - - it("should not parse incorrect IndexParameters") { - JsonValidator.parse[IndexParameters]("{}") match { - case Right(_) => throw new Exception("This test should fail.") - case Left(e) => e.toList.map(_.getMessage) shouldBe List( - "#: 3 schema violations found", - "#: required key [indices] not found", - "#: required key [typeName] not found", - "#: required key [dataType] not found" - ) - } - } - - it("should not parse incorrect IngestParameters") { - JsonValidator.parse[IngestParameters[String]]("{}") match { - case Right(_) => throw new Exception("This test should fail.") - case Left(e) => e.toList.map(_.getMessage) shouldBe List( - "#: 3 schema violations found", - "#: required key [typeName] not found", - "#: required key [dataType] not found", - "#: required key [uri] not found" - ) - } - } - - it("should not parse incorrect DeleteParameters") { - JsonValidator.parse[DeleteParameters]("{}") match { - case Right(_) => throw new Exception("This test should fail.") - case Left(e) => e.toList.map(_.getMessage) shouldBe List( - "#: 2 schema violations found", - "#: required key [typeName] not found", - "#: required key [indexName] not found" - ) - } - } -} diff --git a/geowave/src/test/scala/geotrellis/geowave/dsl/VoxelBoundsSpec.scala b/geowave/src/test/scala/geotrellis/geowave/dsl/VoxelBoundsSpec.scala deleted file mode 100644 index 9228279622..0000000000 --- a/geowave/src/test/scala/geotrellis/geowave/dsl/VoxelBoundsSpec.scala +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2021 Azavea - * - * 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 geotrellis.geowave.dsl - -import cats.syntax.option._ - -import org.scalatest.funspec.AnyFunSpec -import org.scalatest.matchers.should.Matchers - -class VoxelBoundsSpec extends AnyFunSpec with Matchers { - describe("VoxelSpec") { - it("should build split VoxelBounds2D") { - val bounds = VoxelDimensions2D(100, 100).toVoxelBounds - val splits = bounds.split(VoxelDimensions2D(10, 10)) - - splits.length shouldBe 10 * 10 - splits.foreach { vb => - (vb.colMax - vb.colMin) shouldBe 10 - 1 - (vb.rowMax - vb.rowMin) shouldBe 10 - 1 - } - } - - it("should build split VoxelBounds3D") { - val bounds = VoxelDimensions3D(100, 100, 100).toVoxelBounds - val splits = bounds.split(VoxelDimensions3D(10, 10, 10)) - - splits.length shouldBe 10 * 10 * 10 - splits.foreach { vb => - (vb.colMax - vb.colMin) shouldBe 10 - 1 - (vb.rowMax - vb.rowMin) shouldBe 10 - 1 - (vb.depthMax - vb.depthMin) shouldBe 10 - 1 - } - } - - it("should build split VoxelBounds4D") { - val bounds = VoxelDimensions4D(100, 100, 100, 100).toVoxelBounds - val splits = bounds.split(VoxelDimensions4D(10, 10, 10, 10)) - - splits.length shouldBe 10 * 10 * 10 * 10 - splits.foreach { vb => - (vb.colMax - vb.colMin) shouldBe 10 - 1 - (vb.rowMax - vb.rowMin) shouldBe 10 - 1 - (vb.depthMax - vb.depthMin) shouldBe 10 - 1 - (vb.spissitudeMax - vb.spissitudeMin) shouldBe 10 - 1 - } - } - - it("should create valid VoxelDimensions from TilingBounds") { - val tb = TilingBounds(depth = 1.some) - val bounds = VoxelBounds3D(0, 100, 0, 100, 0, 100).toVoxelDimensions - bounds.withTilingBounds(tb) shouldBe VoxelDimensions3D(100, 100, 1) - } - } -} diff --git a/geowave/src/test/scala/geotrellis/geowave/ingest/IngestGeoTiffSpec.scala b/geowave/src/test/scala/geotrellis/geowave/ingest/IngestGeoTiffSpec.scala deleted file mode 100644 index 4a898c15e9..0000000000 --- a/geowave/src/test/scala/geotrellis/geowave/ingest/IngestGeoTiffSpec.scala +++ /dev/null @@ -1,303 +0,0 @@ -/* - * Copyright 2021 Azavea - * - * 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 geotrellis.geowave.ingest - -import geotrellis.geowave.dsl._ -import geotrellis.geowave.dsl.syntax._ -import geotrellis.geowave.adapter.geotiff._ -import geotrellis.geowave.adapter.geotiff.GeoTiffAdapter.GEOTIFF_TIME_FORMATTER_DEFAULT -import geotrellis.geowave.api.SQueryBuilder -import geotrellis.geowave.index.query.ExplicitSpatialTemporalElevationQuery -import geotrellis.raster.MultibandTile -import geotrellis.raster.io.geotiff.GeoTiff - -import org.locationtech.geowave.core.geotime.store.query.{ExplicitSpatialQuery, ExplicitSpatialTemporalQuery} -import org.locationtech.geowave.core.store.CloseableIterator -import org.locationtech.geowave.core.index.sfc.data.NumericRange -import org.locationtech.geowave.core.geotime.store.dimension.Time.TimeRange -import org.locationtech.geowave.core.store.query.filter.BasicQueryFilter -import cats.syntax.option._ -import geotrellis.vector._ -import cats.Id - -import java.net.URI -import java.time.ZonedDateTime -import java.util.Date - -import geotrellis.geowave.TestEnvironment -import org.scalatest.matchers.should.Matchers -import cats.effect.IO - -class IngestGeoTiffSpec extends TestEnvironment with Matchers { - lazy val uri: String = "src/test/resources/raster/all-ones.tif" - - val ingestParameters = IngestParameters[TilingBounds]( - typeName = "IngestMultibandGeoTiffSpec".typeName, - dataType = "GeoTiff".dataType, - uri = new URI(uri), - options = TilingBounds(depth = 1.some).some, - namespace = "IngestMultibandGeoTiffSpec".some - ) - - val indexParameters = IndexParameters( - indices = IndexDefinition( - indexName = "IngestMultibandGeoTiffSpec".some, - indexType = "spatial_temporal_elevation".indexType, - indexOptions = Map() - ), - typeName = "IngestMultibandGeoTiffSpec".typeName, - dataType = "GeoTiff".dataType, - namespace = "IngestMultibandGeoTiffSpec".some - ) - - val date = ZonedDateTime.from(GEOTIFF_TIME_FORMATTER_DEFAULT.parse("2019:11:01 12:00:00")).toInstant - - val deleteParameters = DeleteParameters( - typeName = "IngestMultibandGeoTiffSpec".typeName, - indexName = "IngestMultibandGeoTiffSpec", - geometry = - """ - |{"type":"Polygon","coordinates":[[[141.7066666666667,-18.373333333333342],[141.7066666666667,-17.52000000000001],[142.56000000000003,-17.52000000000001],[142.56000000000003,-18.373333333333342],[141.7066666666667,-18.373333333333342]]]} - |""".stripMargin.parseGeoJson[Polygon]().some, - namespace = "IngestMultibandGeoTiffSpec".some, - time = new TimeRange(0, date.toEpochMilli).some, - elevation = new NumericRange(0d, 30000d).some, - compareOp = BasicQueryFilter.BasicQueryCompareOperation.INTERSECTS - ) - - describe("IngestMultibandGeoTiffSpec spatial temporal elevation index spec") { - val index = ConfigureIndex(indexParameters).head - val indexName = indexParameters.indices.flatMap(_.indexName).head - - // default behavior is to read the whole file as a single tile - val iterator = IngestGeoTiff.dataTypeReader[IO].read(new URI(uri), options=None).unsafeRunSync() - val tiff = iterator.next() - lazy val geowaveDataStore = ingestParameters.dataStore - - it("index name should be set as expected") { - indexName shouldBe indexName - } - - it("should write indexed GeoTiff") { - IngestGeoTiff(ingestParameters) - } - - it("should query the entire contents of a store") { - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(indexParameters.typeName) - .indexName(indexName) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe true - val actualTiff = it.next() - actualTiff.toByteArray should contain theSameElementsAs tiff.toByteArray - it.hasNext shouldBe false - } - - it("should query store by extent") { - val extent = tiff.extent - val spatialQuery = new ExplicitSpatialQuery(extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(indexParameters.typeName) - .indexName(indexName) - .constraints(spatialQuery) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe true - val actualTiff = it.next() - - actualTiff.toByteArray should contain theSameElementsAs tiff.toByteArray - it.hasNext shouldBe false - } - - it("should query store by time") { - val extent = tiff.extent - val dateString = "2019:11:01 12:00:00" - val date = Date.from(ZonedDateTime.from(GEOTIFF_TIME_FORMATTER_DEFAULT.parse(dateString)).toInstant) - val spatialTemporalQuery = new ExplicitSpatialTemporalQuery(date, date, extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(indexParameters.typeName) - .indexName(indexName) - .constraints(spatialTemporalQuery) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe true - val actualTiff = it.next() - - actualTiff.toByteArray should contain theSameElementsAs tiff.toByteArray - it.hasNext shouldBe false - } - - it("should query store by elevation") { - val extent = tiff.extent - val dateString = "2019:11:01 12:00:00" - val date = Date.from(ZonedDateTime.from(GEOTIFF_TIME_FORMATTER_DEFAULT.parse(dateString)).toInstant) - val stdQuery = ExplicitSpatialTemporalElevationQuery(1, date, date, extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(indexParameters.typeName) - .indexName(indexName) - .constraints(stdQuery) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe true - val actualTiff = it.next() - - actualTiff.toByteArray should contain theSameElementsAs tiff.toByteArray - it.hasNext shouldBe false - } - - it("should return nothing querying out of the spatial tiff bounds") { - val extent = Extent(0, 0, 1, 1) - val dateString = "2019:11:01 12:00:00" - val date = Date.from(ZonedDateTime.from(GEOTIFF_TIME_FORMATTER_DEFAULT.parse(dateString)).toInstant) - val spatialTemporalQuery = new ExplicitSpatialTemporalQuery(date, date, extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(indexParameters.typeName) - .indexName(indexName) - .constraints(spatialTemporalQuery) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe false - } - - it("should return nothing querying out of the temporal bounds") { - val extent = tiff.extent - val dateString = "2017:11:01 12:00:00" - val date = Date.from(ZonedDateTime.from(GEOTIFF_TIME_FORMATTER_DEFAULT.parse(dateString)).toInstant) - val spatialTemporalQuery = new ExplicitSpatialTemporalQuery(date, date, extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(indexParameters.typeName) - .indexName(indexName) - .constraints(spatialTemporalQuery) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe false - } - - it("should query nothing out of the elevation bounds") { - val extent = tiff.extent - val dateString = "2019:11:01 12:00:00" - val date = Date.from(ZonedDateTime.from(GEOTIFF_TIME_FORMATTER_DEFAULT.parse(dateString)).toInstant) - val stdQuery = ExplicitSpatialTemporalElevationQuery(100, date, date, extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(indexParameters.typeName) - .indexName(indexName) - .constraints(stdQuery) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe false - } - - it("should return nothing querying out of the spatialtemporal bounds") { - val extent = Extent(0, 0, 1, 1) - val dateString = "2017:11:01 12:00:00" - val date = Date.from(ZonedDateTime.from(GEOTIFF_TIME_FORMATTER_DEFAULT.parse(dateString)).toInstant) - val spatialTemporalQuery = new ExplicitSpatialTemporalQuery(date, date, extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(indexParameters.typeName) - .indexName(indexName) - .constraints(spatialTemporalQuery) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe false - } - - it("should delete nothing by the query out of bounds") { - val extent = Extent(0, 0, 1, 1) - val dateString = "2017:11:01 12:00:00" - val date = Date.from(ZonedDateTime.from(GEOTIFF_TIME_FORMATTER_DEFAULT.parse(dateString)).toInstant) - val spatialTemporalQuery = new ExplicitSpatialTemporalQuery(date, date, extent.toPolygon()) - - val dquery = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(indexParameters.typeName) - .indexName(indexName) - .constraints(spatialTemporalQuery) - - geowaveDataStore.delete(dquery.build()) shouldBe true - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(indexParameters.typeName) - .indexName(indexName) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe true - } - - it("should delete everything by the query") { - val extent = tiff.extent - val dateString = "2019:11:01 12:00:00" - val date = Date.from(ZonedDateTime.from(GEOTIFF_TIME_FORMATTER_DEFAULT.parse(dateString)).toInstant) - val spatialTemporalQuery = new ExplicitSpatialTemporalQuery(date, date, extent.toPolygon()) - - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(indexParameters.typeName) - .indexName(indexName) - .constraints(spatialTemporalQuery) - - geowaveDataStore.delete(query.build()) shouldBe true - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe false - } - - it("should delete everything using the DeleteParameters") { - // write it again - IngestGeoTiff(ingestParameters) - // execute the delete query - ExecuteQuery.delete(deleteParameters) - - // should query nothing - val query = - SQueryBuilder - .newBuilder[GeoTiff[MultibandTile]] - .addTypeName(indexParameters.typeName) - .indexName(indexName) - - val it: CloseableIterator[GeoTiff[MultibandTile]] = geowaveDataStore.query(query.build()) - it.hasNext shouldBe false - } - } -} diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 85e2e4f309..696b173326 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -22,8 +22,6 @@ object Version { val accumulo = "1.9.3" val cassandra = "3.7.2" val hbase = "2.4.2" - val geomesa = "2.3.1" - val geowave = "1.2.0" val hadoop = "3.2.1" val gdal = "3.1.0" val gdalWarp = "1.1.1" @@ -94,11 +92,6 @@ object Dependencies { val cassandraDriverCore = "com.datastax.cassandra" % "cassandra-driver-core" % Version.cassandra val guava = "com.google.guava" % "guava" % "16.0.1" - val geomesaJobs = "org.locationtech.geomesa" %% "geomesa-jobs" % Version.geomesa - val geomesaAccumuloJobs = "org.locationtech.geomesa" %% "geomesa-accumulo-jobs" % Version.geomesa - val geomesaAccumuloDatastore = "org.locationtech.geomesa" %% "geomesa-accumulo-datastore" % Version.geomesa - val geomesaUtils = "org.locationtech.geomesa" %% "geomesa-utils" % Version.geomesa - val scaffeine = "com.github.blemale" %% "scaffeine" % "4.0.2" val caffeine = "com.github.ben-manes.caffeine" % "caffeine" % "2.8.5" @@ -111,16 +104,6 @@ object Dependencies { val geotoolsMetadata = "org.geotools" % "gt-metadata" % Version.geotools val geotoolsOpengis = "org.geotools" % "gt-opengis" % Version.geotools - val geowaveRaster = "org.locationtech.geowave" % "geowave-adapter-raster" % Version.geowave - val geowaveVector = "org.locationtech.geowave" % "geowave-adapter-vector" % Version.geowave - val geowaveIndex = "org.locationtech.geowave" % "geowave-core-index" % Version.geowave - val geowaveStore = "org.locationtech.geowave" % "geowave-core-store" % Version.geowave - val geowaveGeotime = "org.locationtech.geowave" % "geowave-core-geotime" % Version.geowave - val geowaveAccumulo = "org.locationtech.geowave" % "geowave-datastore-accumulo" % Version.geowave - val geowaveCassandra = "org.locationtech.geowave" % "geowave-datastore-cassandra" % Version.geowave - - val geowaveGuava = "com.google.guava" % "guava" % "25.1-jre" - val scalaArm = "com.jsuereth" %% "scala-arm" % "2.0" val kryoSerializers = "de.javakaffee" % "kryo-serializers" % "0.38" diff --git a/project/Settings.scala b/project/Settings.scala index fbdd6ea3cf..672adbed23 100644 --- a/project/Settings.scala +++ b/project/Settings.scala @@ -271,26 +271,6 @@ object Settings { ) ) - lazy val geomesa = Seq( - name := "geotrellis-geomesa", - libraryDependencies ++= Seq( - geomesaAccumuloJobs, - geomesaAccumuloDatastore, - geomesaUtils, - scalatest % Test - ), - console / initialCommands := - """ - import geotrellis.raster._ - import geotrellis.vector._ - import geotrellis.proj4._ - import geotrellis.layer._ - import geotrellis.spark._ - import geotrellis.spark.util._ - import geotrellis.spark.io.geomesa._ - """ - ) ++ commonSettings ++ noForkInTests - lazy val geotools = Seq( name := "geotrellis-geotools", libraryDependencies ++= Seq( @@ -320,39 +300,11 @@ object Settings { Test / testOptions += Tests.Setup { () => Unzip.geoTiffTestFiles() } ) ++ commonSettings ++ noForkInTests - lazy val geowave = Seq( - name := "geotrellis-geowave", - libraryDependencies ++= Seq( - newtype, - java8Compat, - circe("generic-extras").value, - circe("json-schema").value, - geowaveStore, - geowaveIndex, - geowaveGeotime, - geowaveGuava % Test, // tracking geowave guava requirement - geowaveCassandra % Test, - scalatest % Test, - logbackClassic % Test - ), - Test / fork := true - ) ++ commonSettings - - lazy val geowaveBenchmark = Seq( - name := "geotrellis-geowave-benchmark", - libraryDependencies ++= Seq( - geowaveGuava, // tracking geowave guava requirement - geowaveCassandra, - logbackClassic - ), - Test / fork := true - ) ++ commonSettings - lazy val hbase = Seq( name := "geotrellis-hbase", - libraryDependencies += - hbaseMapReduce - exclude("javax.servlet", "servlet-api") + libraryDependencies += + hbaseMapReduce + exclude("javax.servlet", "servlet-api") exclude("org.mortbay.jetty", "servlet-api-2.5"), libraryDependencies += jacksonCoreAsl, console / initialCommands := diff --git a/scripts/createHeaders.sh b/scripts/createHeaders.sh index d5ba0ec4fc..15f85b6896 100755 --- a/scripts/createHeaders.sh +++ b/scripts/createHeaders.sh @@ -5,7 +5,6 @@ "project cassandra" createHeaders test:createHeaders \ "project cassandra-spark" createHeaders test:createHeaders \ "project doc-examples" createHeaders test:createHeaders \ - "project geomesa" createHeaders test:createHeaders \ "project geotools" createHeaders test:createHeaders \ "project hbase" createHeaders test:createHeaders \ "project hbase-spark" createHeaders test:createHeaders \ diff --git a/scripts/geowaveTestDB.sh b/scripts/geowaveTestDB.sh deleted file mode 100755 index 05849c4bfe..0000000000 --- a/scripts/geowaveTestDB.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -echo leader localhost > /tmp/hostaliases -docker pull jamesmcclain/geowave:e62deaf -docker network create --driver bridge geowave -docker run -td --restart=always --net=geowave \ - -p 50095:5009 -p 21810:2181 -p 9997:9997 -p 9999:9999 \ - --hostname leader --name leader \ - jamesmcclain/geowave:e62deaf