Hi, 2014-09-04 23:04 GMT+02:00 Glynn Clements <[email protected]>: > > Sören Gebbert wrote: > >> > > I am struggling to access GRASS mapset specific environmental >> > > variables from mapsets different than the current one in C. >> > ... >> > > Is there a possibility to access mapset specific environmental >> > > variables in C from a different mapset as the current one? >> > >> > Hi, >> > >> > I would suggest to use the mapsets' VAR file, not gisrc (g.gisenv), >> > to store per-mapset variables like that. Since gisrc is per-session >> > and ephemeral, not per-mapset and remembered after the session is >> > closed. >> >> Actually that is exactly what i am trying to do. So my question is how to >> convince grass to read the VAR file from a mapset other than the current >> one without invoking g.mapset. > > Currently, you can't. G__gisinit() calls G_init_env() which reads both > environment files into memory. The functions which read these files > will not attempt to read them again if they're already in memory. > > You would need to modify lib/gis/env.c to allow the "VAR" environment > to be forcibly re-read (and without first re-reading the "gisrc" > environment, as that will restore the original current mapset).#
Thank you for this clear answer. I have implemented a patch to allow force reading of mapset VAR and gisrc files in libgis[1] including some tests. I would like to submit it in the next week, if there are no objections against the patch? Best regards Soeren [1] http://trac.osgeo.org/grass/ticket/2408 > > -- > Glynn Clements <[email protected]> _______________________________________________ grass-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/grass-dev
