[GRASS-dev] Re: [GRASS-user] v.out.ogr multiple

Moving this over to grass-dev: is there a gisprompt for directories instead of files ?

Also, where can one see all the defined gisprompts for g.parser ?

Moritz

On 09/07/08 13:26, Gabriele N. wrote:

Thanks Moritz.

I have made some improvements.
I give you an example and the new script. Now I export all vectors with
name that starts with "foglio_1"

But I do not know how to select a folder where to export the shapes. Now,
only works if I enter the path by hand or select from a graphical user
interface a file in the folder (prova).

But it begins to work :slight_smile:

Still suggestions?

Thanks

Gabriele

http://www.nabble.com/file/p18359390/Schermata-v.out.ogr_multiplo.sh.png
Schermata-v.out.ogr_multiplo.sh.png http://www.nabble.com/file/p18359390/v.out.ogr_multiplo.sh
v.out.ogr_multiplo.sh

Moritz Lennert-2 wrote:

On 09/07/08 10:42, Gabriele N. wrote:

Hi Moritz.

Moritz Lennert-2 wrote:

On 08/07/08 22:33, Gabriele N. wrote:

Hello.
I want to create a script bash (GUI) to export many vector in shapefile
having the opportunity to decide which export layer (0, 1, 2) and
type=line,area ecc..

Does this mean interactive decision layer by layer, or that the module should allow for entering layer and type as an option ?

I would also like to know if you can use the characters as' * 'to be
able
to
export all instance vector starting with' nome_vector ....'.

There is already some scripts? If not, I started to write something in
bash
but I am in difficulty.

It will have to be something like:

for map in `g.mlist type=vect pattern=$GIS_OPT_PATTERN
   do
    v.out.ogr $map type=$GIS_OPT_TYPE layer=$GIS_OPT_LAYER
   done

where GIS_OPT_PATTERN would be something like 'nome_vector*'

If you need to automatically decide which layers and types to export, you might be able to do some grep/awk magic with v.category -g $map option=report.

Moritz
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

I would like to insert layer and type as an option.
  
Attached is what I have done (GUI and script). However, there are errors. http://www.nabble.com/file/p18356967/Schermata-v.out.ogr_multiplo.sh.png Schermata-v.out.ogr_multiplo.sh.png http://www.nabble.com/file/p18356967/v.out.ogr_multiplo.sh
v.out.ogr_multiplo.sh

Where I wrong?

It would be easier to help you if you gave us more information about the errors...

But from looking at your script, I already see this:

for map in g.mlist type=vect pattern=$GIS_OPT_PATTERN

should be:

for map in `g.mlist type=vect pattern=$GIS_OPT_PATTERN`

note the backticks (`)

and then

v.out.ogr input=${map} ...

should be v.out.ogr input=$map

Moritz

Moritz
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Moritz Lennert wrote:

Moving this over to grass-dev: is there a gisprompt for directories
instead of files ?

No.

Also, where can one see all the defined gisprompts for g.parser ?

gis_prompt() in lib/gis/parser.c.

However, that list isn't guaranteed to be exhaustive.

--
Glynn Clements <glynn@gclements.plus.com>

On 11/07/08 23:48, Glynn Clements wrote:

Moritz Lennert wrote:

Moving this over to grass-dev: is there a gisprompt for directories instead of files ?

No.

Wouldn't it make sense to include one ? How hard is this ?

Also, where can one see all the defined gisprompts for g.parser ?

gis_prompt() in lib/gis/parser.c.

However, that list isn't guaranteed to be exhaustive.

Could you elaborate on this ? :wink:

When writing a script, how can one know which options are available ?

Moritz

Moritz Lennert wrote:

>> Moving this over to grass-dev: is there a gisprompt for directories
>> instead of files ?
>
> No.

Wouldn't it make sense to include one ?

Quite possibly.

How hard is this ?

AFAICT, you would need to add support in three places: gis_prompt()
(for terminal interaction), the Tcl/Tk GUI (lib/gis/gui.tcl), and the
wxPython GUI.

>> Also, where can one see all the defined gisprompts for g.parser ?
>
> gis_prompt() in lib/gis/parser.c.
>
> However, that list isn't guaranteed to be exhaustive.

Could you elaborate on this ? :wink:

When writing a script, how can one know which options are available ?

You can use any string you wish as the gisprompt value. Mostly,
G_parser() just passes that string along without interpreting it. If
the gisprompt string is not given or isn't recognised, the UI will
just expect the user to enter a string. Recognised values will result in a
more specific interaction; e.g. the terminal interaction may allow you
to obtain a list of valid answers by typing "list", the GUIs may
display a list of choices, etc.

--
Glynn Clements <glynn@gclements.plus.com>