[GRASS-dev] layer names

Markus Metz markus.metz.giswork at googlemail.com
Sun Oct 18 08:57:58 EDT 2009


Martin Landa wrote:
> Hi all,
>
> most of the functions in Vlib takes layer number as argument. To
> support layer names we need just change their prototypes to use 'const
> char *' instead of 'int' and update all modules. Then layer will found
> by number and if failed by name - see Vect_get_field2(). 
Layer number is always available, like category number, because it's 
stored both in the coor and the cidx file, even without topology and 
without an attribute table linked to a vector layer. Layer names 
associated with a layer number are only available (currently) if dblinks 
are present, otherwise layers have only numbers if I understand 
Vect_read_dblinks() properly.
> The second
> approach would be to add new functions ending by '2', e.g.
> Vect_cidx_find_all2(.., const char *layer, ...), etc.
>
> What do you think? From my point of view would be better just change
> prototypes without adding new and new functions which just takes layer
> as a string...
>   
I think using new Vect_get_field2() in modules is sufficient to support 
layer names. When copying a vector map or only dblinks, layer names are 
already automatically copied as well. It's more like making layer names 
available to users through a modified layer input option that can take 
both numbers and names?

Markus M


More information about the grass-dev mailing list