Hi Devon, Jody,
This looks exciting! For the (E)CQL filters as predicates, is there any
chance those predicates could be passed down to the FeatureSource? Or
would there be different execution from...
featureSource.stream.filter(predicate)....
and
featureSource.getFeatures(predicate).stream....
Naively, it seems what you suggested (and my first example) would stream
back all the features and then apply all filtering 'client' side. If
there are tricks to write the first and have it perform database queries
sensibly, that might be good.
If that support is only partial or is intuitive, I'd worry that we are
giving folks a way to cause too much trouble. On the other hand, if
there are really clever options for pushing around computation, weaving
that through the FeatureSource/Collection API could be really powerful.
Cheers,
Jim
On 8/5/2016 7:07 PM, Jody Garnett wrote:
Reviewing the methods with Devon a lot of it looked pretty straight
forward using FeatureSource and visitor.
featureSource.stream().forEach(
f -> System.out.println( f.getId() ) );
);
Once concern I had, well Kevin had, was how to handle predicates
cleanly. There is an overlap of functionality between Predicates and
our Filter interface - it would be great Filter could implement
Predicate (allowing them to be used for java streams) and allowing us
to detect the use of:
Filter predicate = CQL.toFilter("attName >= 5");
boolean found = featureSource.stream().anyMatch( predicate );
featureSource.stream().filter( predicate ).forEach(
f -> System.out.println( f.getId() ) );
);
Collection<Geometry> geoms = featureSource.stream().map(
f -> (Geometry) f.getDefaultGeometry();
).collect( Collectors.toList() );
--
Jody Garnett
On 5 August 2016 at 14:45, Devon Tucker <devonrtuc...@gmail.com
<mailto:devonrtuc...@gmail.com>> wrote:
Hi all,
Jody and I were talking today about and idea he has been agitating
for a while. We'd like to basically implement the Java 8 streaming
interface for features on top of FeatureSource or
FeatureCollection. Just throwing this out there for early feedback
to see what people think.
Jody thinks that much of that API can be implemented in terms of
the existing functionality fairly simply/efficiently while others
can be delegated to simpler Stream objects (created from builder
utilities).
Interested in what people think. We'll probably do a quick
proposal shortly.
Cheers,
Devon
------------------------------------------------------------------------------
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
<mailto:GeoTools-Devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/geotools-devel
------------------------------------------------------------------------------
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel
------------------------------------------------------------------------------
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel