I have generated a script where all the .dtm files in a directory will be translated into .tif in another directory.

The issue here is that in some computers, a window appears after each iteration asking for projection (even if the tif file is not added to the canvas) and the process stops until you close that window.

I guess it must be something to do in order to avoid this window appearance, almost during an script execution.

I use to work with qgis 2.18.12

  • 1
    I would suggest you preempt it and define the projection of the TIFF file correctly and the canvas too just to be sure; I take it each newly created file is added to the canvas. What language is your script in? Can you show some of the important bits of your code? – Michael Stimson Apr 26 '18 at 11:34

Guessing that you're using python (you've add the tag).

Elaborating this question you could avoid the crs prompt:

from PyQt4.QtCore import QSettings

settings = QSettings()
oldParameter = settings.value( "/Projections/defaultBehaviour", "prompt", type=str )
settings.setValue( "/Projections/defaultBehaviour", "useProject" )

#add your script here

settings.setValue( "/Projections/defaultBehaviour", oldParameter )

Take care to restore the original settings with the last line of code example.

Instead of the parameter "useProject" you could use "useGlobals" that use the default QGIS value.

Last thing, you could even do it from the gui from QGIS menù: Settings --> CRS --> CRS for new layers


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.