3

I have multiple computers with QGIS installed on them. I regularly use the same WMS / WFS services. Now I have to connect to these services for each QGIS installation separately.

It would be great if there was a way to place the configuration for connections in the QGIS browser on a centralised locations (such as a NAS). That way I could access the same connections from every QGIS installation without having to add them manually every time.

Is this possible and, if so, how?

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Mark Verschuur
  • 732
  • 8
  • 22
  • What platform are you on? – Nathan W Feb 23 '14 at 09:48
  • Good point: OSx, ubuntu and sometimes Windows (to keep things simple). However, if I can arrange it for OSx and Ubuntu, I'm a happy camper. I have a NAS where I could store the configuration (if possible). – Mark Verschuur Feb 23 '14 at 09:54

3 Answers3

8

Normally on each OS QGIS will install the settings in a different location, however there is a switch you can start QGIS with to redirect these settings.

When you start QGIS you can start it with the --optionspath and --configpath switches which you can point to a different location.

QGIS will now create all the settings in a ini format and move the .qgis2 folder. You can just move the settings if you like but if you want to have a sycned QGIS over all your install just move both then everything is always there, plugins and all.

So an example would be:

qgis --optionspath "X:\mynat\qgis" --configpath "X:\mynat\qgis"

Now on each machine you start QGIS with these args and they will all point to the same place keeping each one in sync.

Nifty!

user2856
  • 65,736
  • 6
  • 115
  • 196
Nathan W
  • 34,706
  • 5
  • 97
  • 148
  • and this will make a good blog post. Added to the todo list. – Nathan W Feb 23 '14 at 11:40
  • Sounds good! I will try that! – Mark Verschuur Feb 24 '14 at 08:00
  • 1
    I just tried --settingspath and --optionspath with QGIS 2.0 (osgeo4w) on Win 7, but I think I'm doing something wrong here. Just adding --optionspath "C:\new\user\folder" kind of works, but QGIS will create a new default profile at the designated folder instead of migrating mine. Adding --settingspath "C:\new\user\folder" won't do anything and causes these error messages: "The layer Z:\OSGeo\bin--settingspath is not a valid layer and can not be added to the map" and "The layer C:\new\user\folder\ is not a valid layer and can not be added to the map". – SAnderka Feb 27 '14 at 10:29
  • Sorry it was --configpath – Nathan W Feb 27 '14 at 10:37
  • Yes it wont migrate them for you but let me look into that there should be a way. – Nathan W Feb 27 '14 at 10:46
  • Just tried this custom shortcut: C:\OSGeo\bin\qgis.bat --configpath "C:\OSGeo\usrdata\config" --settingspath "C:\OSGeo\usrdata\settings". I did not manually create the folders \settings and \config before. QGIS will create \config on launch, but as written above with a default profile. --settingspath doesn't work at all - no folder \settings, and again the error messages "The layer C:\OSGeo\bin--settingspath is not a valid layer and can not be added to the map" as well as "The layer C:\OSGeo\usrdata\settings is not a valid layer and can not be added to the map". – SAnderka Feb 27 '14 at 11:50
  • Not nagging here, but may this helps you somehow. Are these optional switches documented somewhere? I would love to use this to sync my QGIS profiles at work and at home. At bit off-topic: where can I find the list of saved WMS servers in QGIS 1.8? They didn't get migrated when I upgraded to QGIS 2.0, and I'd love to avoid having to copy each string manually... – SAnderka Feb 27 '14 at 12:05
  • Eh, ignore the last part about exporting the WMS server list - totally missed the "save" button... also: --optionspath instead of --settingspath as you just wrote on your blog will create a new folder and a QGIS2.ini file, but again use default values instead of my own ones. – SAnderka Feb 27 '14 at 13:11
  • I'll add a bit of Python code to export current settings tomorrow – Nathan W Feb 27 '14 at 13:15
  • Please Excuse my ignorance but I am a little lost on where to start with setting --optionspath "X:\mynat\qgis" --configpath "X:\mynat\qgis" do I type this into osgeo42 shell or do I go to the Qgis desktop icon and go to properties? Could someone possible give a step by step implementing this using windows? – CrazySpatial Feb 27 '14 at 19:29
  • @CrazySpatial see my blog post http://nathanw.net/2014/02/24/syncing-qgis-settings/ – Nathan W Feb 27 '14 at 20:40
  • Thanks Nathan I actually found this post through your Blog. What is hanging me up is where do I find target to append the --optionspath "X:\mynat\qgis" --configpath "X:\mynat\qgis" ? – CrazySpatial Feb 27 '14 at 20:52
  • Yeah on the target on the shortcut. – Nathan W Feb 27 '14 at 20:53
  • Did you find a way to make QGIS export the existing user profile to the new location specified above? – SAnderka Mar 03 '14 at 13:44
  • @NathanW: Do you have any update on exporting settings from the Win registry to the options-/configpath? In general: Can options and config be saved to the same folder (i.e. use the same path for both) or would that mess up something? – dpprdan Apr 07 '17 at 07:23
  • things have changed quite a bit in newer versions, there are now options to manage this very cleanly, see my answer below https://gis.stackexchange.com/a/360894/7594 – mbernasocchi May 07 '20 at 09:30
3

One slightly different way to approach this is Mapproxy.

http://mapproxy.org

This enables you take WMS feeds from different sources and add them to your own WMS service. You then just need to add this one wms to QGIS.

There is also the possibility of setting up a cache as well so that should help speed things up too.

James S
  • 4,264
  • 2
  • 32
  • 46
2

Things have changed quite a bit in the newer QGIS versions.

In the current LTR (3.10) you can

  • have a look at the globalsettingsfile flag. You can specify the path for a Global Settings file (.ini), also known as the Default Settings. The settings in the specified file replace the original inline default ones, but the user profiles’ settings will be set on top of those

  • use an organisation deployment customized file and set the environment variable QGIS_GLOBAL_SETTINGS_FILE to the path of your customized file.

and from 3.14 you'll be able to put a global settings file also in the default location managed by the user or system administrator which is not touched by the installer and does not require any additional setup like passing command-line parameters or settings environment variable. Only the first found file will be used. On Linux AppData location usually is $HOME/.local/share/QGIS/QGIS3, on Windows %AppData%\Roaming\QGIS\QGIS3

mbernasocchi
  • 590
  • 2
  • 11