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


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to