public FeatureCollection<SimpleFeatureType,SimpleFeature> toStreamingFeatureCollection(final Envelope bounds) throws IOException {
return toStreamingFeatureCollection(Neo4jFeatureBuilder.getTypeFromLayer(layer), bounds);
}
public FeatureCollection<SimpleFeatureType,SimpleFeature> toStreamingFeatureCollection(SimpleFeatureType featureType, final Envelope bounds) throws IOException {
final Neo4jFeatureBuilder featureBuilder = new Neo4jFeatureBuilder(layer);
return new AbstractFeatureCollection(featureType) {
@Override
public int size() {
return Integer.MAX_VALUE;
}
@Override
protected Iterator<SimpleFeature> openIterator() {
return new Iterator<SimpleFeature>() {
@Override
public boolean hasNext() {
return GeoPipeline.this.hasNext();
}
@Override
public SimpleFeature next() {
return featureBuilder.buildFeature(GeoPipeline.this.next().getRecord());
}
@Override
public void remove() {
throw new UnsupportedOperationException();