use of org.locationtech.geowave.core.store.api.IngestOptions in project geowave by locationtech.
the class CustomIngestPluginExample method run.
public void run() throws URISyntaxException {
// Create an in-memory data store to use with this example
dataStore = DataStoreFactory.createDataStore(new MemoryRequiredOptions());
// Create the spatial index
spatialIndex = new SpatialIndexBuilder().createIndex();
// Configure ingest options to use our custom plugin
final IngestOptions.Builder<SimpleFeature> ingestOptions = IngestOptions.newBuilder();
// Set our custom ingest plugin as the format to use for the ingest
ingestOptions.format(new CustomIngestPlugin());
// Get the path of the geonames text file from the example resources
final File geonamesFile = new File(CustomIngestPlugin.class.getClassLoader().getResource("geonames.txt").toURI());
// Ingest the data
dataStore.ingest(geonamesFile.getAbsolutePath(), ingestOptions.build(), spatialIndex);
// Perform a query on the data
try (final CloseableIterator<SimpleFeature> iterator = dataStore.query(null)) {
while (iterator.hasNext()) {
System.out.println("Query match: " + iterator.next().getAttribute("Location"));
}
}
}
Aggregations