actinia-core icon indicating copy to clipboard operation
actinia-core copied to clipboard

changed v.info -c to v.db.connect -c

Open linakrisztian opened this issue 1 year ago • 2 comments

#359: By changing v.info -c to v.db.connect -c, GRASS does not return an error for vector maps with missing table. Instead this message is printed: "Map <test_random_vect> is not connected to a database". Thus the endpoint does not return an error anymore.

linakrisztian avatar Jul 28 '22 15:07 linakrisztian

A GRASS vector can have no database connection at all or one or several database connections, one possible connection for each layer. The common case is that a vector has one database connection, the corresponding layer is layer 1. For other cases v.info -c or v.db.connect -c does not make sense because no columns would be reported or only columns for layer 1, ignoring attribute columns for other layers. The class EphemeralVectorInfo()reports general information about a vector. Therefore I would argue that this is the wrong place for column names and types of a specific layer. Instead, any database connections as reported by v.db.connect -g() would be useful information in this place. After that, a user might want to know column names and types of a specific vector layer, see also https://github.com/OSGeo/grass/blob/main/python/grass/script/vector.py#L101.

Maybe introduce a new endpoint where the layer of a vector can be specified?

metzm avatar Jul 29 '22 07:07 metzm

Instead of a new endpoint for a vector layer, the syntax also recognized by TGIS could be used: <name>:<layer>@<mapset>. If a layer is given, v.db.connect -c layer=<layer> map=<name> could be used, otherwise v.db.connect -g map=<name>.

metzm avatar Jul 29 '22 08:07 metzm