Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orbisprocess #43

Closed
ebocher opened this issue Jan 24, 2019 · 6 comments
Closed

Orbisprocess #43

ebocher opened this issue Jan 24, 2019 · 6 comments
Assignees
Milestone

Comments

@ebocher
Copy link
Member

ebocher commented Jan 24, 2019

I share here some examples about orbisprocess library. A library to write process based on orbiswps job and the famous geoscript library.

//Declare
Process p = new Process([inputA: String],[outputA: String], { inputA ->
          [outputA: inputA.trim]
         }
         )
//Execute
 p.execute([inputA : 'OrbisGIS is nice'])

Note that the input and output parameters must be controlled.

@ebocher
Copy link
Member Author

ebocher commented Jan 24, 2019

The input and output types could be dynamically extended using an OSGI service registry.

@ebocher
Copy link
Member Author

ebocher commented Jan 24, 2019

//Compute a buffer around a geometry and returns a new geometry
//Geometry types supported are JTS Geometry classes
 Process p = new Process("Create a buffer around a geometry",[inputA: Geometry, distance: double], [outputA: Geometry], { inputA, distance ->
             [outputA: inputA.buffer(distance)]
         }
         )
         p.execute([inputA : new WKTReader().read("POINT(10 1)")] )] )

@ebocher
Copy link
Member Author

ebocher commented Jan 24, 2019

//Example with a table from H2GIS
def h2GIS = H2GIS.open([databaseName: './target/loadH2GIS'])
         h2GIS.execute("""
                DROP TABLE IF EXISTS h2gis, super;
                CREATE TABLE h2gis (id int, the_geom point);
                INSERT INTO h2gis VALUES (1, 'POINT(10 10)'::GEOMETRY), (2, 'POINT(1 1)'::GEOMETRY);
        """)

         Process p = new Process([inputA: ITable],[outputA: String], { inputA ->
             [outputA: inputA.columnNames]
         }
         )
         p.execute([inputA : h2GIS.getSpatialTable("h2gis")])

SPalominos added a commit that referenced this issue Jan 25, 2019
Implements the process manager API.
Fix the pom for the JAVA 8 compilation.
Integrate test from #43
@ebocher
Copy link
Member Author

ebocher commented Jan 27, 2019

//An advanced type of the String with custom parameters
//Custom parameters must be controlled, thanks to the Caster.class
 Process p = new Process([inputA: [title:'My input', type : String, minOccurs=1 maxOccurs=1] ],[outputA: String], { inputA ->
             [outputA: inputA.columnNames]
         }
         )
         p.execute([inputA : "A string value"])

Below a possible list of input types

[title : "A title", type : BoudingBox, supportedCRS = {"EPSG:4326", "EPSG:2000", "EPSG:2001"}, dimension = 2]

[title : "A title", type : RawData, multiSelection = true, isDirectory = false, isFile = false,excludedTypes = {".sql", ".shp"}, fileTypes = {".dbf", ".txt"}]

[title : "A title", type : EnumData, isEditable = true, multiSelection = true, values = {"value1", "value2"}, names = {"name1","name2"}]

@ebocher
Copy link
Member Author

ebocher commented Jan 27, 2019

A new use case

@Test
    void testSimpleProcess5(){
        def process = processFactory.create(
                "title",
                [inputA : String[]],
                [outputA : String],
                { inputA -> [outputA : inputA[1]] }
        )
        process.execute([inputA :["A", "B", "C"]])
        assertEquals "B", process.getResults().outputA
    }

@SPalominos
Copy link
Contributor

Next use case will be added directly to the test files.

@SPalominos SPalominos added this to the v1.0.0 milestone May 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants