Comments (7)
What if we want functions such as "st_buffer" that needs arguments ? Should we add ['st_area', 'st_type', 'st_perimeter', ['st_buffer', 100]] or it is not designed for this purpose ?
from orbisdata.
it is not designed for this purpose.
from orbisdata.
In the process declaration, for the inputs and outputs, the pattern is [inputA : type, inputB, type, ...]
.
In the case of the example :
@Test
void testArrayInput(){
def process = processFactory.create(
"title",
[inputA : String[]],
[outputA : String],
{ inputA ->[outputA : inputA[0]+'the_geom) as area']}
)
}
from orbisdata.
That is right.
However, I still do not see whether or not a Table should be passed as input. In the case this is not the case, it means that another process should execute the sql query from an input table ?
Anyway, in the script presented here, we must at least loop on the list[] and give a "correct" name to the field that will be created in the future ?
@Test
void testArrayInput(){
def process = processFactory.create(
"title",
[inputA : String[]],
[outputA : String],
{ inputA ->
concat = ""
for (fct in inputA){
concat += '$fct(the_geom) as ${fct[3..-1]},'
}
[outputA : concat[0..-2]}
)
}
from orbisdata.
You can pass an ITable as a process input, but you should no call getJdbcDataSource on it (this possibility will be removed soon). If you want to do so, you should pass the JdbcDataSource (H2GIS or POSTGIS object as example).
For your example, you just have a problem of quoting, instead of concat += '$fct(the_geom) as ${fct[3..-1]},'
you should write concat += "$fct(the_geom) as ${fct[3..-1]},"
(double quote instead of simple quote). The ${myVar[i]}
syntax works only inside double quote.
This test works well with simple array as input (like ['st_area', 'st_type', 'st_perimeter']
.
To be able to use input like ['st_area', 'st_type', 'st_perimeter', ['st_buffer', 100]]
you should write something like :
for (fct in inputA){
concat += fct instanceof List ?
"${fct[0]}(the_geom, ${fct[1]}) as ${fct[0][3..-1]}," :
"$fct(the_geom) as ${fct[3..-1]},"
}
that will give you as output "st_area(the_geom) as area,st_type(the_geom) as type,st_perimeter(the_geom) as perimeter,st_buffer(the_geom, 100) as buffer"
from orbisdata.
@ebocher Is this issue still open ?
from orbisdata.
nop thx
from orbisdata.
Related Issues (20)
- Trouble with createIndex using POSTGIS ? HOT 2
- Filter subquery bug HOT 1
- Use smile-io to save dataframe
- OrbisDATA bad use of PreparedStatement HOT 1
- ResultSet/Statement configuration not transmitted to child/filtered tables HOT 1
- H2GIS, POSTGIS getSpatialTable recursive call ? HOT 1
- .gz not loadable yet ? HOT 1
- JdbcDataSource Statement caching
- Cache resultset metadata in IJdbcTable
- Use only PreparedStatements
- Default autocommit to false.
- Remove groovy Sql extends on JdbcDataSource
- Is there a rename or setName function ? HOT 1
- RDBC spec as provider for JDBC connection HOT 1
- Delegate ISpatial and ITable construction
- Avoid ResultSet creation
- No metadata check for spatial table
- Rework modules architecture HOT 3
- getColumnsTypes() column order not consistent HOT 1
- Removed unused badges HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from orbisdata.