|
From: LSA <ls...@ng...> - 2010-09-22 09:53:25
|
I am using geotools 2.6.3.
I try do it like this:
FeatureCollection features = getFeatures();
org.opengis.feature.type.Name name =
features.getSchema().getDescriptor("MyAttr").getName();
features = features.sort(new SortByImpl(filterFactory.property(name),
SortOrder.ASCENDING));
However, it fails with NPE (because index==null) at getFeatureMember (
int position = index.indexOf( id );), when I call *features*.features():
public SimpleFeature getFeatureMember( String id ) throws
NoSuchElementException {
int position = index.indexOf( id );
if( position == -1){
throw new NoSuchElementException(id);
}
if( collection instanceof RandomFeatureAccess ){
RandomFeatureAccess random = (RandomFeatureAccess) collection;
random.getFeatureMember( id );
}
return (SimpleFeature) get( position );
}
Any ideas?
Thanks in advance,
Sergey
|