Linfiniti Geo Blog GIS for Open Source People

23Jul/110

Batch customizing QGIS

So, as seen in my previous post on customizing the QGIS UI, it's now possible to completely customize the QGIS interface, adding or removing items as you choose. You can save some layouts, and apply them as needed. It all comes built into QGIS, presented in a handy visual interface. This lets you check and uncheck boxes to activate and deactivate various items on the screen. Which is great, if your own machine is all you need to worry about.

But let's say you're in a situation where there's more than one user. Say, for example, that you're teaching a class on GIS concepts. You want all the students to keep up with what you're doing, so you'd like only the tools necessary for that class to be on the screen. In fact, you want everyone's QGIS to be configured exactly the same way as yours, and in more ways than just the UI.

In that case, there are two handy files to know about: QGIS.conf and QGISCUSTOMIZATION.conf. In Linux, you'll find them under /home/your_user_name/.config/QuantumGIS/. (If you've done something interesting with your install, or you're using another OS, you may have to search for those two files.)

When QGIS loads, it takes a look at those files to configure itself. What's great about this is that, for the most part, these files are written in plain English. The format goes more or less like this:

[Customizable Thing]
aspect_of_customizable_thing=some_property

Or, to name an example:

[locale]
userLocale=en_ZA

With some exceptions, these are all easily human-readable, and hence, modifiable.

QGISCUSTOMIZATION.conf contains only one set of customization options, called (surprisingly) Customization. This is the set of options that is used to activate or deactivate various parts of the UI. The options themselves are all in this format:

some\element\on\the\interface=state

For example:

StatusBar\mCoordsEdit=true
StatusBar\mCoordsLabel=false

... which will let your UI display your cursor's current geographic coordinates in the status bar, but not precede the coordinate display area with the (useless) "Coordinates:" label.

But here's something (arguably) even more interesting: the contents of QGIS.conf, the main configuration file. This goes beyond just the UI, and influences literally every customizable aspect of QGIS! Even including your database connections:

[PostgreSQL]
connections\foo\service=
connections\foo\host=localhost
connections\foo\port=5432
connections\foo\database=foo
connections\foo\username=foo_user
connections\foo\password=foo_password
connections\foo\publicOnly=false
connections\foo\geometryColumnsOnly=false
connections\foo\allowGeometrylessTables=true
connections\foo\sslmode=1
connections\foo\saveUsername=true
connections\foo\savePassword=true
connections\foo\estimatedMetadata=false

And your plugins:

[PythonPlugins]
plugin_installer=true
fTools=true
mapfile_tools=false
mapserver_export=false

And the list goes on. You can explore these files yourself, of course: what they contain depends greatly on what all you've done in your current install of QGIS.

But you don't even need to edit them by hand to gain a benefit from them. If you know where they are, and there's a standard setup on all the computers you'd like to customize, it's easy enough to throw a bash script out there that will configure all the machines en masse. For instance, say you've got a directory that looks like this:

batch_customize.sh .config/standard_qgis_install/QGIS.conf
.config/standard_qgis_install/QGISCUSTOMIZATION.conf

Then all that would need to be in batch_customize.sh is this:

#!/bin/bash
cp -r .config /home/*

... to be run on all the machines that need to be customized. Obviously, if you're using not-UNIX, this will have to look a bit different, but the same idea applies. You can set QGIS up in a standard way for a given purpose, and distribute this setup around easily. Following which, all the machines you have applied this process on will have a standardized QGIS setup. You might even want to put this folder on a network location somewhere, and configure all the computers to copy those files over on startup, which will minimize your maintenance.

Either way, if you want to apply a setup to a whole set of computers, there's no need to go from machine to machine to do it by hand. Just use the config files strategically, and you'll cut down on the effort required. And, since these files contain everything that can possibly be configured, you can be assured that the setup is identical on all machines. Problem solved! spacer

spacer

Enjoy this article?

Consider subscribing to our rss feed!

Filed under: QGIS Leave a comment
Comments (0) Trackbacks (0) ( subscribe to comments on this post )

No comments yet.


Leave a comment Cancel reply

You must be logged in to post a comment.

No trackbacks yet.

New data browser for QGIS! » « Linfiniti goes scrummy

Linfiniti.com

We are mad about Free and Open Source Software and are here to help others who want to use Open Source GIS software but don't know where to start!

Recent Posts

  • Extract projection tool for QGIS
  • Shield Labels for QGIS
  • FOSS GIS learning resources
  • New hatching modes in QGIS Master (line pattern fill)
  • Improvements to raster performance in QGIS master
  • QGIS Training in Dar Es Salaam
  • New data browser for QGIS!
  • Batch customizing QGIS
  • Linfiniti goes scrummy
  • Customizing the QGIS UI

Archives

gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.