-
-
Notifications
You must be signed in to change notification settings - Fork 398
g.parser: Extend --json flag and documentation #6697
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
base: main
Are you sure you want to change the base?
Changes from 6 commits
8d4bbf8
c16cf80
8aefd0f
a0408d6
b21bb58
2af5c30
0ab891d
de48425
6c4b67b
6208074
63758e2
7197c4a
3f63048
dfe09f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -255,28 +255,72 @@ v.in.db --interface-description | |
| ## JSON | ||
|
|
||
| The flag **--json** added to a GRASS command with parameters mandatorily | ||
| to be specified generates a module interface description in JSON. | ||
| Example: | ||
| to be specified generates a module interface description in JSON. The JSON | ||
| output can be used as building blocks in actinia processing chains. | ||
|
|
||
| actinia specific parametrization is supported for both import and export. | ||
|
|
||
| Import of input data is denoted with a "@" as delimiter followed by a | ||
| valid URL. | ||
|
|
||
| Export of raster, vector or other file-based date if invoked with a | ||
| "+" behind the file-name followed by an actinia-format name. Formats | ||
| currently supported are: | ||
|
|
||
| - COG | ||
| - GTiff | ||
| - GPKG | ||
| - SQLite | ||
| - GML | ||
| - GeoJSON | ||
| - ESRI_Shapefile | ||
| - CSV | ||
| - TXT | ||
| - PostgreSQL | ||
|
|
||
| Many GRASS modules produce textual output to stdout and actinia allows | ||
ninsbl marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| to export that output as well, however, the **--json** flag does not yet | ||
| allow to specify export of stdout which may look in an actinia processing | ||
| chain e.g. like this: | ||
|
|
||
| ```json | ||
| { | ||
| ... | ||
| 'stdout': {'id': 'stats', 'format': 'kv', 'delimiter': '='}, | ||
| } | ||
| ``` | ||
|
Comment on lines
281
to
293
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not clear. What a user is supposed to do here? I'm missing something like "So, to do X, do A, B and C."
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please check the updated text... |
||
|
|
||
| Here is a full example for usage of the **--json** flag: | ||
|
|
||
| ```sh | ||
| v.in.db driver=sqlite database=mysqlite.db table=pointsfile x=x y=y z=z key=idcol out=dtmpoints --json | ||
| r.slope.aspect --o --q -e \ | ||
| elevation="elevation@https://storage.googleapis.com/graas-geodata/elev_ned_30m.tif" \ | ||
| slope="slope+GTiff" aspect="aspect+GTiff" --json | ||
| ``` | ||
|
|
||
| ```json | ||
| { | ||
| "module": "v.in.db", | ||
| "id": "v.in.db_1804289383", | ||
| "module": "r.slope.aspect", | ||
| "overwrite": true, | ||
| "quiet": true, | ||
| "id": "r.slope.aspect_1804289383", | ||
| "flags":"e", | ||
| "inputs":[ | ||
| {"param": "table", "value": "pointsfile"}, | ||
| {"param": "driver", "value": "sqlite"}, | ||
| {"param": "database", "value": "mysqlite.db"}, | ||
| {"param": "x", "value": "x"}, | ||
| {"param": "y", "value": "y"}, | ||
| {"param": "z", "value": "z"}, | ||
| {"param": "key", "value": "idcol"} | ||
| {"import_descr": {"source":"https://storage.googleapis.com/graas-geodata/elev_ned_30m.tif", "type":"raster"}, | ||
| "param": "elevation", "value": "elevation"}, | ||
| {"param": "format", "value": "degrees"}, | ||
| {"param": "precision", "value": "FCELL"}, | ||
| {"param": "zscale", "value": "1.0"}, | ||
| {"param": "min_slope", "value": "0.0"}, | ||
| {"param": "nprocs", "value": "0"}, | ||
| {"param": "memory", "value": "300"} | ||
| ], | ||
| "outputs":[ | ||
| {"param": "output", "value": "dtmpoints"} | ||
| {"export": {"format":"GTiff", "type":"raster"}, | ||
| "param": "slope", "value": "slope"}, | ||
| {"export": {"format":"GTiff", "type":"raster"}, | ||
| "param": "aspect", "value": "aspect"} | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -552,6 +552,7 @@ int G_parser(int argc, char **argv) | |
| "both. Assuming --verbose.")); | ||
| } | ||
| st->quiet = -1; | ||
| st->superquiet = -1; | ||
|
||
| } | ||
|
|
||
| /* Quiet option */ | ||
|
|
@@ -568,11 +569,13 @@ int G_parser(int argc, char **argv) | |
| "both. Assuming --quiet.")); | ||
| } | ||
| st->quiet = 1; /* for passing to gui init */ | ||
| st->superquiet = -1; | ||
| } | ||
|
|
||
| /* Super quiet option */ | ||
| else if (strcmp(ptr, "--qq") == 0) { | ||
| char buff[32]; | ||
| st->superquiet = 1; | ||
|
|
||
| /* print nothing, but errors */ | ||
| st->module_info.verbose = G_verbose_min(); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.