Somebody in my neighbourhood is Windows Administrator on a ‘Middelbare School’ here in Haarlem, my hometown.
The school, het Mendelcollege, received a (Q)GIS intro by Margit Stapel of GisWijzer who is doing introductions for 10 – 14 year old childer with GIS. The school received this course from a GIS professional as part of the ‘national geo week‘.
One ‘problem’ to solve is how to set up 30 class room computers with QGIS and the demo data.
We set together to think about the possible setups and after some discussion, I think we had a good plan. We share it here hoping it helps other System Admins to setup QGIS on schools.
First thing was the actual installation: one every class room computer? Or on a shared network drive. The last option seems easiest and cleanest, and that route was taken: just do a vanilla OSGeo4W installation of QGIS on a Windows Share and QGIS is available for everybody in the classroom.
Then there are some things to consider:
- QGIS writes it’s settings on Windows in the Windows Registry, and uses a $USER/.qgis2 folder to stash all other settings, plugins, cache etc etc
- In this case the Windows Profile of the kids would too small because we make heavily use of OGC services, relying on a cache to speed up. QGIS defaults to writing the cache in the .qgis2 folder
It turns out that you can start up QGIS with some extra command line parameters to change default behavour:
$ qgis --help
src/app/main.cpp: 402: (main) Starting qgis main
QGIS - 2.3.0-Master 'Master' (80b7021)
QGIS is a user friendly Open Source Geographic Information System.
Usage: /home/richard/apps/qgis/master/debug/bin/qgis [OPTION] [FILE]
[--snapshot filename] emit snapshot of loaded datasets to given file
[--width width] width of snapshot to emit
[--height height] height of snapshot to emit
[--lang language] use language for interface text
[--project projectfile] load the given QGIS project
[--extent xmin,ymin,xmax,ymax] set initial map extent
[--nologo] hide splash screen
[--noplugins] don't restore plugins on startup
[--nocustomization] don't apply GUI customization
[--customizationfile] use the given ini file as GUI customization
[--optionspath path] use the given QSettings path
[--configpath path] use the given path for all user configuration
[--code path] run the given python file on load
[--defaultui] start by resetting user ui settings to default
[--help] this text
So, using this:
qgis.exe --configpath c:/temp/foo
you instruct QGIS to NOT use the defaults for the Settings and .qgis2 folder, but create a new clean(!) set of settings in the given path, AND use an ini file for all options and put it in the file QGIS/QGIS2.ini
Note that with:
qgis.exe --optionspath c:/temp/foo
you instruct QGIS to use the QGIS/QGIS2.ini file in given path, but use the normal .qgis2 folder for all other files.
So with this information you can think out a lot of scenario’s. The one we came up with:
- one osgeo4w install on a shared network disk
- find the .bat file which starts QGIS: c:/OSGeo4W/bin/qgis.bat and change the last line:
start "QGIS" /B "%OSGEO4W_ROOT%"\bin\qgis-bin.exe %*
start "QGIS" /B "%OSGEO4W_ROOT%"\bin\qgis-bin.exe --configpath c:/temp/qgisconfig %*
- copy the demonstration data to c:\temp\qgisdata of all individual computers
Now all kids could enjoy a nice QGIS lesson
Off course you can create all kind of scenario’s. One issue we faced was that the first class could mess up the nicely created symbolisation in th data directory (stored in the .qgs file). Or edit or remove some data.
So it would be nice if we would have created a copy of the config and data dirs (some ‘template’ directories), and upon starting a fresh class let a script run which would overwrite the excisting used directories.
Another scenario would be to start with certain set of QGIS plugins. This could be done by either putting them in the c:\temp\qgisconfig\python\plugins dir. OR in the plugins dir of the QGIS installation itself on the shared disk: x:\OSGeo4w\apps\python\plugins\. You will need them have enabled them to be usable immediately, so enable them when you create the template ini options ini file.
How does QGIS stores it’s settings, cache, plugins and other assets?
QGIS, being a program written on Qt4 and uses Qt’s QSettings mechanisme to store all kind of settings.
So what is in this settings (‘options’) file? Here you can download an example of the file in which I started QGIS, downloaded and installed two plugins and loaded a WMTS layer. It’s in the default ini format: in the PythonPlugins section, you see which plugins you have enabled. You can find your locale there, but also the positions, geometry and sizes of all the windows QGIS uses. The settings (and username/passwords) for database connections are in there etc etc. Have a look in it, pretty interesting.
Note that on Windows, the default way of doing QSettings, is by writing all this information in registry. If you want to look into that, have a look near this registry keys:
Linux on the other hand just puts an ini file in you home directory:
If you use the configpath option on Windows, it also uses the ini format.
What other settings (‘config’) does QGIS use? Have a look in your User/Home directory in the .qgis2 directory. You will find some directories in it:
- python/plugins: holding your downloaded python plugins (QGIS actually just downloads a zip and unzips it in that directory)
- cache: the default directory for caching WMS/WMTS and other imaging
- processing: default location for intermediate results of processing
And some files:
- qgis.db: an sqlite database holding all Projection / Spatial Reference Systems information QGIS uses
For fun: just start QGIS once with the configpath parameter and have a look into the directories and files, just to get some insights into QGIS internals.