use of org.apache.sis.internal.storage.wkt.StoreFormat in project sis by apache.
the class MetadataReader method addIdentificationInfo.
/**
* Adds a {@code DataIdentification} element if at least one of the required attributes is non-null.
*
* @param publisher the publisher names, built by the caller in an opportunist way.
*/
private void addIdentificationInfo(final Set<InternationalString> publisher) {
boolean hasExtent = false;
Set<String> project = null;
Set<String> standard = null;
final Set<String> keywords = new LinkedHashSet<>();
for (final String path : searchPath) {
decoder.setSearchPath(path);
keywords.addAll(split(stringValue(KEYWORDS.TEXT)));
standard = addIfNonNull(standard, stringValue(STANDARD_NAME.TEXT));
project = addIfNonNull(project, stringValue(PROJECT));
for (final String keyword : split(stringValue(ACCESS_CONSTRAINT))) {
addAccessConstraint(forCodeName(Restriction.class, keyword));
}
addTopicCategory(forCodeName(TopicCategory.class, stringValue(TOPIC_CATEGORY)));
addSpatialRepresentation(forCodeName(SpatialRepresentationType.class, stringValue(DATA_TYPE)));
if (!hasExtent) {
/*
* Takes only ONE extent, because a netCDF file may declare many time the same
* extent with different precision. The groups are ordered in such a way that
* the first extent should be the most accurate one.
*/
hasExtent = addExtent();
}
}
/*
* For the following properties, use only the first non-empty attribute value found on the search path.
*/
decoder.setSearchPath(searchPath);
addAbstract(stringValue(SUMMARY));
addPurpose(stringValue(PURPOSE));
addSupplementalInformation(stringValue(COMMENT));
addCredits(stringValue(ACKNOWLEDGEMENT));
// Legacy spelling.
addCredits(stringValue("acknowledgment"));
addUseLimitation(stringValue(LICENSE));
addKeywords(standard, KeywordType.THEME, stringValue(STANDARD_NAME.VOCABULARY));
addKeywords(keywords, KeywordType.THEME, stringValue(KEYWORDS.VOCABULARY));
addKeywords(project, KeywordType.valueOf("PROJECT"), null);
addKeywords(publisher, KeywordType.valueOf("DATA_CENTRE"), null);
/*
* Add geospatial bounds as a geometric object. This optional operation requires
* an external library (ESRI or JTS) to be present on the classpath.
*/
final String wkt = stringValue(GEOSPATIAL_BOUNDS);
if (wkt != null) {
addBoundingPolygon(new StoreFormat(decoder.geomlib, decoder.listeners).parseGeometry(wkt, stringValue(GEOSPATIAL_BOUNDS + "_crs"), stringValue(GEOSPATIAL_BOUNDS + "_vertical_crs")));
}
}
Aggregations