Hi,
i need an indexed DataSource, therefore i tried the following:

FeatureSource<SimpleFeatureType,SimpleFeature> roads = 
pgDataStore.getFeatureSource("roads");
                                                
SpatialIndexFeatureCollection rFc = new SpatialIndexFeatureCollection();
rFc.addAll( roads.getFeatures( filter ) );

log.debug("roads schema: "+roads.getSchema());
log.debug("rfc schema: "+rFc.getSchema());
                                                
roads = DataUtilities.source( rFc );
log.debug("roads schema: "+roads.getSchema() );
                        
log.debug(roads.getFeatures().size());
log.debug(roads.getFeatures(filter).size());

The output, when i run the program is:

2010-08-09 11:49:11,165 DEBUG [main] urban.DataAggregation: roads schema: 
SimpleFeatureTypeImpl roads identified extends 
Feature(osm_id:osm_id,name:name,type:type,layer:layer,tunnel:tunnel,bridge:bridge,oneway:oneway,trackType:trackType,bicycle:bicycle,foot:foot,horse:horse,motorcycle:motorcycle,motorcar:motorcar,motor_vehicle:motor_vehicle,agricultural:agricultural,the_geom:the_geom)
2010-08-09 11:49:11,165 DEBUG [main] urban.DataAggregation: rfc schema: null
2010-08-09 11:49:11,168 DEBUG [main] urban.DataAggregation: roads schema: null
2010-08-09 11:49:11,212 DEBUG [main] urban.DataAggregation: 3595
java.lang.NullPointerException
        at 
org.geotools.data.collection.SpatialIndexFeatureSource.getFeatures(SpatialIndexFeatureSource.java:106)
        at 
org.geotools.data.collection.SpatialIndexFeatureSource.getFeatures(SpatialIndexFeatureSource.java:62)
        at urban.DataAggregation.buildSample(DataAggregation.java:419)
        at urban.DataAggregation.main(DataAggregation.java:474)

The NPE-exception occurs during the getFeatures(filter) call, but i don't 
really have a clue why, because without the filter-argument, the methode gets 
called without problems.
Am i doing something that is not intended by the developers? Is this a bug? Why 
does the SpatialIndexFeatureCollection does not have a Schema?

Thank you,
Julian

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to