[GRASS-dev] OGR write access

Martin Landa landa.martin at gmail.com
Fri Oct 16 10:33:06 EDT 2009


2009/10/16 Markus Metz <markus.metz.giswork at googlemail.com>:


>>> Hmm, for direct OGR write access, you need to specify the format anyway
>>> somewhere? There is already 'format' added to all vector modules which
>>> have
>>> input defined, can't be too difficult. And as I mentioned before, I think
>>> a
>> Probably I don't understand, I can't see 'format' parameter only in
>> v.out.ogr, v.in.ogr and similar modules. Currently would be possible"
> I was referring to grass7 wxGUI e.g. d.vect has a new option element called
> Format with the choices Native and OGR and I suggested to (1) do that with
> e.g. ./shapefiles/@OGR and make that option element a format option in the
> sense of v.[in|out].ogr for output options.

Ah, right, in wxGUI you can choose between native and OGR format to be
read. For native format 'input/map' is enough, for OGR you need to
choose 'input/map' (i.e. OGR datasource) and 'layer' (i.e. OGR layer).
Anyway wxGUI dialogs need to be improved, it was just quick and dirty

>> yes, also olayer would be required. But it would make sense only for
>> OGR format, not the native format, am I right?
> Thinking about it, there may be problems because some modules may produce
> several output layers in the same output vector map if feature cats refer to
> several layers. No idea how to accommodate that with direct OGR write access
> where each OGR layer needs its own name not number. Fetch layer name from
> input vector, append layer number to map name if no layer name available?

I would suggest to use multiple 'olayer' parameter. If number of
produced layers would differ from the number of 'olayers', the module
ends up with an error and nothing is written to OGR datasource (?)

>> v.extract in=imap layer=1 where="..." out="PG:dbname=db" olayer=omap
>> format=PostgreSQL
>> v.extract in=imap layer=1 where="..." out=omap format=native
> Should work, but preferably use input layer name if available?

Yes, if vector layer is defined - currently there are few modules
which write out layer name. I would suggest to modify all vector
modules to write layer name identical with input vector map name (if
more layers produced, then input_1, input_2). Do you agree with it?


Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa

More information about the grass-dev mailing list