1

According to this post it is possible to tweak GDAL globally via the configuration file. On the GDAL website I found the supposed location of the file - $(USERPROFILE)/.gdal/gdalrc - unfortunately, in my case under C:\Users\XXX.gdal\ I only find the folder "2.4" (although I have gdal 3.7 installed via OSGeo4W). Where else could be the gdalrc folder with the configuration file?

sn1ks
  • 2,982
  • 12
  • 28
  • Why don't you use the first option and add an environment variable SET GDAL_CONFIG_FILE=c:\\the\path\that\i\want? By default the configuration file does not exist, you must create it yourself. – user30184 Aug 14 '23 at 08:19
  • with SET, the variable is only there for the current cmd session - i m mostly working with QGIS, so i would need it globally set with SETX GDAL_CONFIG_FILE c:\the\path\that\i\want /m or am I wrong? – sn1ks Aug 14 '23 at 08:30
  • 1
    In a way yes, and you have a couple of options https://www.howtogeek.com/51807/how-to-create-and-use-global-system-environment-variables/. But in the OSGeo4W installation, when you launch QGIS you are actually running a qgis.bat script that is located in the [OSGEO4W_root]/bin directory. You can edit either that bat file directly, or the qgis-bin.env file in the same directory. – user30184 Aug 14 '23 at 08:45
  • ok, got it. many thanks, if you write it as answer i can mark the question as solved! – sn1ks Aug 14 '23 at 08:50
  • If you're primarily working in QGIS, you can set the environment variables from the QGIS Settings dialog. – user2856 Aug 14 '23 at 08:52

1 Answers1

1

You can create it if it doesn't exist in %USERPROFILE%\.gdal\gdalrc.
In Windows Explorer file manager:

  • type %USERPROFILE% into the address bar (or navigate to C:\Users\your_username),
  • create the folder .gdal then
  • in that new folder create a text file gdalrc and put the config options you want.
user2856
  • 65,736
  • 6
  • 115
  • 196