Added by jgarnett, last edited by jgarnett on Jul 25, 2007

Labels

 
(None)

Another set of aggregate functions are aimed at splitting your FeatureCollection up into useful groups. These functions produce a classifier for your FeatureCollection, this concept is similar to a histogram. These classifiers are often used with StyleBuilder to produce really good visualizations of your data.

Creating a Classifier

You can produce a Classifier for your FeatureCollection as follows:

FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
Function classify = ff.function("Quantile", ff.property("name"), ff.literal(2));
        
Classifier groups= (Classifier) classify.evaluate( features );

Customizing your Classifier

You can think of the Classifier as a series of groups or bins into which you will sort Features. Each partition has a title which you can name as you please.

groups.setTitle(0, "Group A");
groups.setTitle(1, "Group B");

Using Your Classifier to group Features

You can then use this Classifier to sort features into the appropriate group:

Function sort = ff.function("classify",ff.property("name"), ff.literal( groups ));
int slot = (Integer) sort.evaluate( feature1 );

System.out.println( groups.getTitle( slot ) ); // ie. "Group A"