Thanks Jody,
good point.
I am using CachingFeatureSource, but I implemented it time ago by myself
and not touched it since. Bug can be there.
But also I tried MemoryDataCollection and run into the same bug.
On 9/22/2010 8:24 PM, Jody Garnett wrote:
Try using the sort option as part of your query? Especially with JDBC
data sources this is faster as the sorting will be done in the database.
Can you tell me what you are using for your source of features right
now? Shapefile or in memory? It sounds like you have found a bug where
sort is not implemented.
Jody
On 22/09/2010, at 7:55 PM, LSA wrote:
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
------------------------------------------------------------------------------
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