<div dir="ltr"><br><br>On Thu, Aug 16, 2018 at 4:06 AM, Pierre Roudier <<a href="mailto:pierre.roudier@gmail.com">pierre.roudier@gmail.com</a>> wrote:<br>><br>> Thanks Vaclav,<br><div><br></div><div><br></div><div>You are welcome. I hope it will be helpful.<br></div><div><br></div><div><br></div>> Looks like a great enhancement. It should make it easy to wrap it into<br>> a R package for example.<br><div><br></div><div><br></div><div>Yes, the idea for this is that it also should make easy to wrap GRASS GIS in whatever you want.<br></div><div><br></div><div><br></div>> One question -- is that possible to refer to the input dataset in the<br>> script called<br>> by --exec? Something like:<br>><br>> grass --tmp-location ~/data/elevation.tiff --exec "r.param.scale<br>> in=myinput out=myoutput param=slope size=9"<br><div><br></div><div><br></div><div>This makes sense since the GUI Startup (and/or Location Wizard) have this functionality (also importing the file after using its SRS). However, this is effectively an API and needs more considerations. How would you suggest to deal with the output when `--tmp-location ~/data/elevation.tiff` creates location with `elevation` raster but than myoutput is deleted with the rest of the location? What about multiple inputs?<br></div><div><br></div><div>At this point, I'm hoping we can move forward through individual issues and use cases (rather than revamping CLI altogether), so you remarks fall into that well. Please, feel to submit an enhancement ticket ideally with a use case, so we can discuss it there.<br></div><div><br></div><div>Please see also a little write-up I did for GSoC idea some time ago:<br></div><div><br></div><div><a href="https://trac.osgeo.org/grass/wiki/GSoC/2018#Neweasy-to-useCLIandAPIforGRASSGIS">https://trac.osgeo.org/grass/wiki/GSoC/2018#Neweasy-to-useCLIandAPIforGRASSGIS</a><br></div><div><br></div><div>Best,</div><div>Vaclav<br></div><div><br></div>> Cheers,<br>><br>> P<br>><br>> On 15 August 2018 at 15:20, Vaclav Petras <<a href="mailto:wenzeslaus@gmail.com">wenzeslaus@gmail.com</a>> wrote:<br>> > Dear user list,<br>> ><br>> > The (main) GRASS GIS executable, usually available as simply `grass` on most<br>> > systems has now a new option (flag/parameter) in trunk (aka 7.5). The option<br>> > is called --tmp-location.<br>> ><br>> > When specified, GRASS GIS automatically creates an new (and empty) location<br>> > based on provided EPSG code or georeferenced file (similarly to what -c flag<br>> > does). Newly it is also possible to provide string "XY" instead of EPSG to<br>> > create XY (non-georeferenced) location.<br>> ><br>> > This temporary location has only PERMANENT mapset and the whole location is<br>> > removed. The location is created in a temporary directory (which is also<br>> > deleted at the end).<br>> ><br>> > The flag --tmp-location is meant to be used together with --exec and it is a<br>> > part of a lager endeavor to make the CLI easier for use from outside of the<br>> > GRASS GIS session.<br>> ><br>> > If you are interested, please, test this new functionality. It is an<br>> > opportunity to provide feedback before this feature lands in the 7.6<br>> > release.<br>> ><br>> > Here are some things to try:<br>> ><br>> > * Execute a module in a location created based on EPSG:<br>> ><br>> >   grass --tmp-location EPSG:3358 --exec g.region -p<br>> ><br>> > * Execute Python script in a location created based on EPSG:<br>> ><br>> >   grass --tmp-location EPSG:3358 --exec script.py<br>> ><br>> > * Examine the created location using a Bash command:<br>> ><br>> >   grass --tmp-location EPSG:3358 --exec bash -c "g.proj -p && g.region -p &&<br>> > g.mapset -p && g.gisenv GISDBASE,LOCATION_NAME sep=/"<br>> ><br>> > * Get SRS/CRS for a file:<br>> ><br>> >   grass --tmp-location ~/data/elevation.tiff --exec g.proj -p<br>> ><br>> > * Get help text for a module:<br>> ><br>> >   grass --tmp-location XY --exec r.neighbors --help<br>> ><br>> > See the documentation and `grass --help` for more hints (and let me know how<br>> > these can be enhanced).<br>> ><br>> > Best regards,<br>> > Vaclav<br>> ><br>> ><br>> > <a href="https://trac.osgeo.org/grass/ticket/3537">https://trac.osgeo.org/grass/ticket/3537</a><br>> > <a href="https://trac.osgeo.org/grass/ticket/3585">https://trac.osgeo.org/grass/ticket/3585</a><br>> > <a href="https://trac.osgeo.org/grass/ticket/3586">https://trac.osgeo.org/grass/ticket/3586</a><br>> > <a href="https://trac.osgeo.org/grass/changeset/72790">https://trac.osgeo.org/grass/changeset/72790</a><br>> > <a href="https://trac.osgeo.org/grass/changeset/73096">https://trac.osgeo.org/grass/changeset/73096</a><br>> > <a href="https://trac.osgeo.org/grass/changeset/73098">https://trac.osgeo.org/grass/changeset/73098</a><br>> > <a href="https://trac.osgeo.org/grass/changeset/73099">https://trac.osgeo.org/grass/changeset/73099</a><br>> ><br>> ><br>> ><br>> > _______________________________________________<br>> > grass-user mailing list<br>> > <a href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a><br>> > <a href="https://lists.osgeo.org/mailman/listinfo/grass-user">https://lists.osgeo.org/mailman/listinfo/grass-user</a><br><br></div>