use of org.geotools.feature.collection.SortedSimpleFeatureCollection in project coastal-hazards by USGS-CIDA.
the class RibboningProcess method sortFeatures.
// if there's an attribute to sort by, sort by it
public SimpleFeatureCollection sortFeatures(String sortAttribute, SimpleFeatureCollection features) {
SimpleFeatureCollection result = features;
AttributeDescriptor sortAttr = features.getSchema().getDescriptor(sortAttribute);
if (null != sortAttr) {
SortBy sort = new SortByImpl(new AttributeExpressionImpl(sortAttr.getName()), SortOrder.ASCENDING);
result = new SortedSimpleFeatureCollection(features, new SortBy[] { sort });
} else {
LOGGER.log(Level.WARNING, "Could not find sort attribute {0}", sortAttribute);
}
return result;
}
Aggregations