use of org.codice.ddf.spatial.geocoding.FeatureIndexingException in project ddf by codice.
the class GazetteerUpdateCommand method executeWithSubject.
@Override
protected Object executeWithSubject() throws Exception {
final PrintStream console = System.out;
final ProgressCallback progressCallback = progress -> {
console.printf("\r%d%%", progress);
console.flush();
};
final FeatureIndexer.IndexCallback featureIndexCallback = count -> {
console.printf("\r%d features indexed", count);
console.flush();
};
console.println("Updating...");
try {
if (isResourceGeoJSON()) {
featureIndexer.updateIndex(resource, featureExtractor, create, featureIndexCallback);
} else {
geoEntryIndexer.updateIndex(resource, geoEntryExtractor, create, progressCallback);
}
console.println("\nDone.");
} catch (GeoEntryExtractionException | FeatureExtractionException e) {
LOGGER.info("Error extracting data from resource {}", resource, e);
console.printf("Could not extract data from resource %s.%n Message: %s%n Check the logs for more details.%n", resource, e.getMessage());
} catch (GeoEntryIndexingException | FeatureIndexingException e) {
LOGGER.info("Error indexing data", e);
console.printf("Could not index the data.%n Message: %s%n Check the logs for more details.%n", e.getMessage());
} catch (GeoNamesRemoteDownloadException e) {
LOGGER.info("Error downloading resource from remote source {}", resource, e);
console.printf("Could not download the GeoNames file %s.%n Message: %s%n Check the logs for more details.%n", resource, e.getMessage());
}
return null;
}
Aggregations