Package org.geotools.process.vector.AggregateProcess

Examples of org.geotools.process.vector.AggregateProcess.Results


                }

                // build the filter and gather the statistics
                Filter areaFilter = ff.within(ff.property(dataGeomName), ff.literal(zoneGeom));
                SimpleFeatureCollection zoneCollection = data.subCollection(areaFilter);
                Results stats = new AggregateProcess().execute(zoneCollection, dataAttribute,
                        FUNCTIONS, true, null);

                // build the resulting feature
                builder.addAll(zone.getAttributes());
                if(stats != null) {
                    builder.add(stats.getCount());
                    builder.add(stats.getMin());
                    builder.add(stats.getMax());
                    builder.add(stats.getSum());
                    builder.add(stats.getAverage());
                    builder.add(stats.getStandardDeviation());
                }
                return builder.buildFeature(zone.getID());
            } catch (Exception e) {
                throw new ProcessException("Failed to compute statistics on feature " + zone, e);
            }
View Full Code Here


        Process process = Processors.createProcess( name );
        assertNotNull("aggregateProcess not found", process);
        NullProgressListener monitor = new NullProgressListener();
        Map<String, Object> output = process.execute(input, monitor );
       
        Results result = (Results) output.get("result");
        assertTrue( result.sum > 0 );
    }
View Full Code Here

    public void testSum() throws Exception {
        SimpleFeatureSource source = bugs.getFeatureSource("bugsites");

        Set<AggregationFunction> functions = EnumSet.of(AggregationFunction.Sum);
       
        Results result = AggregateProcess.process( source.getFeatures(), "cat",  functions, true, null );
        assertTrue( result.sum > 0 );
    }
View Full Code Here

TOP

Related Classes of org.geotools.process.vector.AggregateProcess.Results

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.