3

When I start a completly new QGIS I need to manually add my often CRS to have them in the list of "recently used crs". I would like to add all of them in a folder somehow and than add the path to the folder and automatically add all crs in the folder to "recently used crs".

Or maybe something like that can be done with a Python script? I'm bad with tasks related to CRS. You think something like that is possible?

I'm using QGIS 3.4.13

  • 3
    Hi DGIS. The recently used CRS is stored in a file called QGIS3.ini which is found in a folder called QGIS in your user profiles folder. So each time you use that profile in the machine it should be remembered. It is one line of text eg recentProjectionsAuthId=EPSG:27700, USER:100000, USER:100001, USER:100002, USER:100003, USER:100004, USER:100005, USER:100006 - from mine with them displayed in QGIS in right to left order in the list. You could use a text editor to replace the line with the CRS you'd like to see? – ian Jan 20 at 13:17
2
  • Create startup.py file on C:\Users\USER\AppData\Roaming\QGIS\QGIS3, if it doesn't exist.
  • Add next script, change path and projections' "authIDs" and "IDs" as you desire and save.

    Note: If you run the script in QGIS Python Editor, you'll see that the changes are applied immediately. But to get always same list of projections on starting QGIS, you need to add the script to startup.py.
from configparser import ConfigParser

# change user path
ini_path = r"C:\Users\USER\AppData\Roaming\QGIS\QGIS3\profiles\default\QGIS\QGIS3.ini"

# Add projections you desire
crsAuthIDs = "EPSG:54004, EPSG:4326, EPSG:XXXX, USER:100000"
crsIDs  = "54004, 4326, XXXX, 100000"

config = ConfigParser()
config.read(ini_path)
config.set('UI','recentProjectionsAuthId', crsAuthIDs)
config.set('UI','recentProjections', crsIDs)

with open(ini_path, 'w') as configfile:
    config.write(configfile)
  • Re-open QGIS.
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.