[GRASS-user] v.what.strds error creating column with @ name

Hi List,

I'm trying to sample an STRDS at some vector points.

My points are generated (from lines in another mapset) with:

v.to.points input=ex1@gates type=line output=points dmax=100

My STRDS is generated in the current mapset (named vel), and then when I run

v.what.strds input=points strds=vx,vy output=test

I get the following error:

DBMI-SQLite driver error:
Error in sqlite3_prepare():
near "@vel_2007_09_07": syntax error

ERROR: Error while executing: 'ALTER TABLE test_points_1 ADD COLUMN vy_2007_09_07_2008_04_23@vel_2007_09_07 DOUBLE PRECISION'
ERROR: Unable to add column <vy_2007_09_07_2008_04_23@vel_2007_09_07 DOUBLE PRECISION>.
ERROR: Unable to add column vy_2007_09_07_2008_04_23@vel_2007_09_07 DOUBLE PRECISION to vector map <test>

'@' is not a valid character name in a DB column. Am I doing something wrong that v.what.strds is trying to generate this column name?

Thanks,

  -k.

Hi Ken,

Were you able to solve the problem or find its cause? Could you create a reproducible example with the NC dataset? It seems really strange, if the mapset is named vel why would it add the date to it too?

Cheers,
Vero

···

Dra. Verónica Andreo
Investigadora Adjunta de CONICET

Instituto Gulich (CONAE - UNC)

Centro Espacial Teófilo Tabanera (CETT)

Falda del Cañete - Córdoba, Argentina

+54 3547 400000 int. 1153
https://veroandreo.gitlab.io/

Hi Veronica,

On 2024-02-03 at 02:52 +13, Veronica Andreo <veroandreo@gmail.com>
wrote...

Were you able to solve the problem or find its cause? Could you create
a reproducible example with the NC dataset? It seems really strange,
if the mapset is named vel why would it add the date to it too?

I'm guessing the problem and cause is me, not GRASS. Before I try to replicate in the NC data set, I hope you can help answer a question.

I'm trying to work in multiple mapsets and with multiple tables. I find this hard to do when they're in different databases, so when I create a new mapset I set the DB connection to PERMANENT:

db.connect database=${LOCATION_NAME}/PERMANENT/sqlite/sqlite.db

I assume this may be part of the problem. Is this common practice? Or is there some other way to work with `db.execute` and multiple databases?

Thanks,

  -k.

Hi Ken,

On Fri, Feb 9, 2024 at 12:23 AM Ken Mankoff via grass-user
<grass-user@lists.osgeo.org> wrote:

Hi Veronica,

On 2024-02-03 at 02:52 +13, Veronica Andreo <veroandreo@gmail.com>
wrote...
> Were you able to solve the problem or find its cause? Could you create
> a reproducible example with the NC dataset? It seems really strange,
> if the mapset is named vel why would it add the date to it too?

I'm guessing the problem and cause is me, not GRASS. Before I try to replicate in the NC data set, I hope you can help answer a question.

I'm trying to work in multiple mapsets and with multiple tables. I find this hard to do when they're in different databases, so when I create a new mapset I set the DB connection to PERMANENT:

db.connect database=${LOCATION_NAME}/PERMANENT/sqlite/sqlite.db

I believe that the quotes are missing - so the variable is immediately
interpreted.

It is important that it really contains '$GISDBASE' etc. and not the
value of $GISDBASE:

db.connect database='$GISDBASE/$LOCATION_NAME/$MAPSET/vector/$MAP/sqlite.db'

The VAR file then contains

-->
DB_DRIVER: sqlite
DB_DATABASE: $GISDBASE/$LOCATION_NAME/$MAPSET/vector/$MAP/sqlite.db
<--

See
https://grass.osgeo.org/grass-stable/manuals/grass-sqlite.html#connecting-grass-to-sqlite

HTH,
Markus

--
Markus Neteler, PhD
https://www.mundialis.de - company
https://grass.osgeo.org - FOSS
https://neteler.org - freelancing & blog

Hi Markus,

I'm trying to work in multiple mapsets and with multiple tables. I
find this hard to do when they're in different databases, so when I
create a new mapset I set the DB connection to PERMANENT:

db.connect database=${LOCATION_NAME}/PERMANENT/sqlite/sqlite.db

I believe that the quotes are missing - so the variable is immediately
interpreted.

I don't think it matters? With quotes it will resolve to real paths sometime later, but LOCATION_NAME never changes, so when/where the variable expansion occurs shouldn't change anything. If $MAPSET were in quotes, then it would create a new DB per mapset, which I do not want, hence hard-coding PERMANENT.

I can't read the URL you sent - I have email but not web browser for another week. But on my local computer grass-sqlite.html manual page says

[...] the file storage location can be freely chosen.

Suggesting I could hard-code this anywhere I want, even outside of the GRASS folder structure.

  -k.