[GRASS-dev] v.overlay handles mapname at mapset in a wrong way

Glynn Clements glynn at gclements.plus.com
Wed Sep 17 14:53:05 PDT 2014


Vaclav Petras wrote:

> it seems [1] that v.overlay cannot handle dot in mapset name which probably
> points to a wrong handling of mapset in a parameter.

Vect_check_input_output_name() doesn't accept fully qualified output
names. It assumes that the output name is an unqualified name (i.e. it
passes it directly to Vect_legal_filename). If the mapset didn't
contain a dot, it would instead complain about the output name
containing an "@".

An attempt was made to fix this in r12350, but this is broken by
design. That change simply makes Vect_legal_filename() accept an "@"
character.

This is wrong on two counts. First, it means that Vect_legal_filename()
no longer performs its original function, i.e. validating an
unqualified map name. Second, it means that it Vect_legal_filename() is
still of no use for validating qualified map names, because it applies
the more restrictive vector names rules[1] to the mapset part of the
name.

I notice that this change has effectively been reverted in r62023
(although the existing version has a redundancy: it explicitly rejects
"@" even though this will already be rejected by virtue of not being an
alphanumeric or underscore).

Either Vect_check_input_output_name() needs to be modified to accept
fully qualified output names (presumably checking that the mapset
component matches the current mapset), or whatever part of TGIS is
passing qualified output names to v.overlay has to stop doing that.

[1] The restrictions on vector names derive from Radim (the developer
of the current vector library) taking the "easy" route.

Each vector map typically has an associated database table for
attributes. So when you create a new vector map, you need to create a
new table for that map. And the table's name is limited by the SQL
syntax (alphanumerics and underscore only, no SQL reserved words).

How to choose an SQL table name which is valid and unique? Easy: just
make vector map names subject to the same restrictions as SQL table
names and use the map name as-is. Well, easy for the developer of the
vector library, not necessarily for everyone else.

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


More information about the grass-dev mailing list