5

I have a project with several .qml files assigned to SHP files with the same name but different data. I am just changing the SHP files, but when I start the project with different SHP I see just the blank map. I can click on Zoom Full but I would like to have the Zoom Full on startup.

Is it possible to set the project to display data at Zoom Full on startup?

7

In QGIS you can specify macros that will be executed on project startup. To do so go to Project > Project Properties > Macros and enable the checkbox at the top. Then modify the openProject() function like this:

def openProject(): from qgis.utils import iface iface.mapCanvas().zoomScale(1000)

The "1000" in the zoomScale() function represents your scale, in this case 1:1000. Save your additions by clicking on "Apply" and close the project properties dialog.

Since macros are turned off by default you have to turn them on first. You can find the corresponding option under Settings > "Options..." at the very bottom of the "General" tab ("Enable macros").

Finally just save your project, the zoom should be automatically adjusted to the given scale on the next project startup.

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.