Search in sources :

Example 1 with GeoToolsVectorDataStoreIngestFormat

use of org.locationtech.geowave.format.geotools.vector.GeoToolsVectorDataStoreIngestFormat in project geowave by locationtech.

the class GeoWaveSpatialBinningAggregationIT method testIngestThenBinnedQuery.

@Test
public void testIngestThenBinnedQuery() {
    final IngestOptions.Builder<SimpleFeature> builder = IngestOptions.newBuilder();
    final DataStore dataStore = dataStoreOptions.createDataStore();
    dataStore.ingest(HAIL_SHAPEFILE_FILE, builder.threads(4).format(new GeoToolsVectorDataStoreIngestFormat().createLocalFileIngestPlugin(new GeoToolsVectorDataOptions())).build(), TestUtils.DimensionalityType.SPATIAL_TEMPORAL.getDefaultIndices());
    try {
        for (final SpatialBinningType type : SpatialBinningType.values()) {
            for (int precision = 1; precision < 7; precision++) {
                testBinnedAggregation(type, precision, new File(TEST_POLYGON_TEMPORAL_FILTER_FILE).toURI().toURL(), TestUtils.DEFAULT_SPATIAL_TEMPORAL_INDEX, dataStore);
            }
        }
    } catch (final Exception e) {
        e.printStackTrace();
        TestUtils.deleteAll(dataStoreOptions);
        Assert.fail("Error occurred while testing a polygon and time range query of spatial temporal index: '" + e.getLocalizedMessage() + '\'');
    }
    TestUtils.deleteAll(dataStoreOptions);
}
Also used : GeoToolsVectorDataOptions(org.locationtech.geowave.format.geotools.vector.GeoToolsVectorDataOptions) SpatialBinningType(org.locationtech.geowave.core.geotime.binning.SpatialBinningType) GeoToolsVectorDataStoreIngestFormat(org.locationtech.geowave.format.geotools.vector.GeoToolsVectorDataStoreIngestFormat) DataStore(org.locationtech.geowave.core.store.api.DataStore) File(java.io.File) IngestOptions(org.locationtech.geowave.core.store.api.IngestOptions) SimpleFeature(org.opengis.feature.simple.SimpleFeature) IOException(java.io.IOException) Test(org.junit.Test)

Example 2 with GeoToolsVectorDataStoreIngestFormat

use of org.locationtech.geowave.format.geotools.vector.GeoToolsVectorDataStoreIngestFormat in project geowave by locationtech.

the class GeoWaveBasicSpatialTemporalVectorIT method testIngestAndQuerySpatialTemporalPointsAndLines.

@Test
public void testIngestAndQuerySpatialTemporalPointsAndLines() {
    // ingest both lines and points
    final IngestOptions.Builder<SimpleFeature> builder = IngestOptions.newBuilder();
    dataStore.createDataStore().ingest(HAIL_SHAPEFILE_FILE, builder.threads(NUM_THREADS).format(new GeoToolsVectorDataStoreIngestFormat().createLocalFileIngestPlugin(new GeoToolsVectorDataOptions())).build(), DimensionalityType.SPATIAL_TEMPORAL.getDefaultIndices());
    if (!POINTS_ONLY) {
        dataStore.createDataStore().ingest(TORNADO_TRACKS_SHAPEFILE_FILE, IngestOptions.newBuilder().threads(NUM_THREADS).build(), DimensionalityType.SPATIAL_TEMPORAL.getDefaultIndices());
    }
    try {
        URL[] expectedResultsUrls;
        if (POINTS_ONLY) {
            expectedResultsUrls = new URL[] { new File(HAIL_EXPECTED_BOX_TEMPORAL_FILTER_RESULTS_FILE).toURI().toURL() };
        } else {
            expectedResultsUrls = new URL[] { new File(HAIL_EXPECTED_BOX_TEMPORAL_FILTER_RESULTS_FILE).toURI().toURL(), new File(TORNADO_TRACKS_EXPECTED_BOX_TEMPORAL_FILTER_RESULTS_FILE).toURI().toURL() };
        }
        testQuery(new File(TEST_BOX_TEMPORAL_FILTER_FILE).toURI().toURL(), expectedResultsUrls, "bounding box and time range");
    } catch (final Exception e) {
        e.printStackTrace();
        TestUtils.deleteAll(dataStore);
        Assert.fail("Error occurred while testing a bounding box and time range query of spatial temporal index: '" + e.getLocalizedMessage() + "'");
    }
    try {
        URL[] expectedResultsUrls;
        if (POINTS_ONLY) {
            expectedResultsUrls = new URL[] { new File(HAIL_EXPECTED_POLYGON_TEMPORAL_FILTER_RESULTS_FILE).toURI().toURL() };
        } else {
            expectedResultsUrls = new URL[] { new File(HAIL_EXPECTED_POLYGON_TEMPORAL_FILTER_RESULTS_FILE).toURI().toURL(), new File(TORNADO_TRACKS_EXPECTED_POLYGON_TEMPORAL_FILTER_RESULTS_FILE).toURI().toURL() };
        }
        testQuery(new File(TEST_POLYGON_TEMPORAL_FILTER_FILE).toURI().toURL(), expectedResultsUrls, "polygon constraint and time range");
    } catch (final Exception e) {
        e.printStackTrace();
        TestUtils.deleteAll(dataStore);
        Assert.fail("Error occurred while testing a polygon and time range query of spatial temporal index: '" + e.getLocalizedMessage() + "'");
    }
    try {
        URL[] statsInputs;
        if (POINTS_ONLY) {
            statsInputs = new URL[] { new File(HAIL_SHAPEFILE_FILE).toURI().toURL() };
        } else {
            statsInputs = new URL[] { new File(HAIL_SHAPEFILE_FILE).toURI().toURL(), new File(TORNADO_TRACKS_SHAPEFILE_FILE).toURI().toURL() };
        }
        testStats(statsInputs, (NUM_THREADS > 1), TestUtils.DEFAULT_SPATIAL_TEMPORAL_INDEX);
    } catch (final Exception e) {
        e.printStackTrace();
        TestUtils.deleteAll(dataStore);
        Assert.fail("Error occurred while testing a bounding box stats on spatial temporal index: '" + e.getLocalizedMessage() + "'");
    }
    try {
        for (int i = 0; i < 5; i++) {
            testSpatialTemporalLocalExportAndReingestWithCQL(new File(TEST_BOX_TEMPORAL_FILTER_FILE).toURI().toURL(), NUM_THREADS, POINTS_ONLY, DimensionalityType.SPATIAL_TEMPORAL);
        }
    } catch (final Exception e) {
        e.printStackTrace();
        TestUtils.deleteAll(dataStore);
        Assert.fail("Error occurred while testing deletion of an entry using spatial index: '" + e.getLocalizedMessage() + "'");
    }
    try {
        testDeleteDataId(new File(TEST_BOX_TEMPORAL_FILTER_FILE).toURI().toURL(), TestUtils.DEFAULT_SPATIAL_TEMPORAL_INDEX);
    } catch (final Exception e) {
        e.printStackTrace();
        TestUtils.deleteAll(dataStore);
        Assert.fail("Error occurred while testing deletion of an entry using spatial temporal index: '" + e.getLocalizedMessage() + "'");
    }
    TestUtils.deleteAll(dataStore);
}
Also used : GeoToolsVectorDataOptions(org.locationtech.geowave.format.geotools.vector.GeoToolsVectorDataOptions) GeoToolsVectorDataStoreIngestFormat(org.locationtech.geowave.format.geotools.vector.GeoToolsVectorDataStoreIngestFormat) File(java.io.File) IngestOptions(org.locationtech.geowave.core.store.api.IngestOptions) SimpleFeature(org.opengis.feature.simple.SimpleFeature) URL(java.net.URL) Test(org.junit.Test)

Aggregations

File (java.io.File)2 Test (org.junit.Test)2 IngestOptions (org.locationtech.geowave.core.store.api.IngestOptions)2 GeoToolsVectorDataOptions (org.locationtech.geowave.format.geotools.vector.GeoToolsVectorDataOptions)2 GeoToolsVectorDataStoreIngestFormat (org.locationtech.geowave.format.geotools.vector.GeoToolsVectorDataStoreIngestFormat)2 SimpleFeature (org.opengis.feature.simple.SimpleFeature)2 IOException (java.io.IOException)1 URL (java.net.URL)1 SpatialBinningType (org.locationtech.geowave.core.geotime.binning.SpatialBinningType)1 DataStore (org.locationtech.geowave.core.store.api.DataStore)1