Package org.geotools.process

Examples of org.geotools.process.Process


       
        //execute the process
        Map<String,Object> result = null;
        Throwable error = null;
        try {
            Process p = pf.create(processName);
            result = p.execute( inputs, null );   
        }
        catch( Throwable t ) {
            //save the error to report back
            error = t;
        }
View Full Code Here


        // octo start
        WKTReader wktReader = new WKTReader(new GeometryFactory());
        Geometry geom = wktReader.read("MULTIPOINT (1 1, 5 4, 7 9, 5 5, 2 2)");
       
        Name name = new NameImpl("tutorial","octagonalEnvelope");
        Process process = Processors.createProcess( name );
       
        ProcessExecutor engine = Processors.newProcessExecutor(2);
       
        // quick map of inputs
        Map<String,Object> input = new KVP("geom", geom);
View Full Code Here

        assertSame(data, computed);
    }
   
    @Test
    public void testDefaultValues() throws Exception {
        Process defaults = factory.create(new NameImpl("bean", "Defaults"));
        Map<String, Object> results = defaults.execute(Collections.EMPTY_MAP, null);
       
        // double check all defaults have been applied
        assertEquals("default string", results.get("string"));
        assertEquals(new WKTReader().read("POINT(0 0)"), results.get("geometry"));
        assertEquals(1, results.get("int"));
View Full Code Here

*/
public class VectorToRasterProcessTest {
   
    @Test
    public void testCreateProcess() throws Exception {
        Process p = Processors.createProcess(new NameImpl("vec", "VectorToRaster"));
        assertNotNull(p);
    }
View Full Code Here

     * Runs the Process.execute method using LineStrings with float values.
     */
    @Test
    public void executeProcessWithFloat() throws Exception {
        System.out.println("   execute process using float values");
        Process p = Processors.createProcess(new NameImpl("vec", "VectorToRaster"));
        assertNotNull(p);

        SimpleFeatureCollection features = createFloatLines();
        ReferencedEnvelope bounds = features.getBounds();
       
        Dimension gridDim = new Dimension(
                (int)bounds.getWidth(),
                (int)bounds.getHeight());

        ProgressListener monitor = null;

        Map<String, Object> map = new HashMap<String, Object>();
        map.put(AbstractFeatureCollectionProcessFactory.FEATURES.key, features);
        map.put("attribute", "value");
        map.put("rasterWidth", gridDim.width);
        map.put("rasterHeight", gridDim.height);
        map.put("bounds", bounds);

        Map<String, Object> result = p.execute(map, monitor);
        GridCoverage2D cov = (GridCoverage2D) result.get("result");
       
        //textPrintFloat(cov);
       
        /*
 
View Full Code Here

     * Runs the Process.execute method using LineStrings with String values that
     * evaluate to integers.
     */
    @Test
    public void executeProcessWithString() throws Exception {
        Process p = Processors.createProcess(new NameImpl("vec", "VectorToRaster"));
        assertNotNull(p);

        SimpleFeatureCollection features = createStringLines();
        ReferencedEnvelope bounds = features.getBounds();

        Dimension gridDim = new Dimension(
                (int)bounds.getWidth(),
                (int)bounds.getHeight());

        ProgressListener monitor = null;

        Map<String, Object> map = new HashMap<String, Object>();
        map.put(AbstractFeatureCollectionProcessFactory.FEATURES.key, features);
        map.put("attribute", "value");
        map.put("rasterWidth", gridDim.width);
        map.put("rasterHeight", gridDim.height);
        map.put("bounds", bounds);

        Map<String, Object> result = p.execute(map, monitor);
        GridCoverage2D cov = (GridCoverage2D) result.get("result");
       
        //textPrint(cov);
       
        /*
 
View Full Code Here

                "aggregationAttribute","cat",
                "function",EnumSet.of(AggregationFunction.Sum),
                "singlePass", true);
       
        NameImpl name = new NameImpl("vec","Aggregate");
        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 aboutToDisplayPanel() {
        JPanel page = getPanel();
        page.removeAll();
        page.setLayout(new GridLayout(0, 2));

        Process process = this.factory.create(name);

        final ProgressListener progress = new JProgressWindow(this.getJWizard());
        Map<String, Object> resultMap = process.execute(paramMap, progress);

        // when we get here, the processing is over so show the result
        JLabel title = new JLabel(factory.getTitle().toString());
        page.add(title);
        JLabel description = new JLabel("Your process results are below:");
View Full Code Here

        }
    }
   
    @Test
    public void testCallViaProcessFactory() {
        Process process = Processors.createProcess(new NameImpl("ras", "PolygonExtraction"));
        assertNotNull(process);
       
        Map<String, Object> inputs = new HashMap<String, Object>();
        inputs.put("data", buildSmallCoverage());
        inputs.put("ranges", Arrays.asList(new Range<Integer>(0, true, 1, true), new Range<Integer>(2, true, 3, true)));
        Map<String, Object> results = process.execute(inputs, null);
        Object result = results.get("result");
        assertTrue(result instanceof SimpleFeatureCollection);
        SimpleFeatureCollection fc = (SimpleFeatureCollection) result;
        assertEquals(4, fc.size());
    }
View Full Code Here

        // based on the describeprocess, setup the execute
        ProcessDescriptionsType processDesc = descResponse.getProcessDesc();
        ProcessDescriptionType pdt = (ProcessDescriptionType) processDesc.getProcessDescription().get(0);
        WPSFactory wpsfactory = new WPSFactory(pdt, this.url);
        Process process = wpsfactory.create();

        // setup the inputs
        Map<String, Object> map = new TreeMap<String, Object>();
        map.put("buffer", 350);
        map.put("geom1", geom1);

        // execute/send-request for the process
        Map<String, Object> results = process.execute(map, null);

        // check that the result is expected
        assertNotNull(results);

        Geometry expected = geom1.buffer(350);
View Full Code Here

TOP

Related Classes of org.geotools.process.Process

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.