Skip to content


[Processing] Check layer projection when using it for subset extent
Browse files Browse the repository at this point in the history
  • Loading branch information
radosuav committed Nov 26, 2015
1 parent da4fe7e commit c58981f
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions python/plugins/processing/gui/
Expand Up @@ -30,13 +30,15 @@
from PyQt4 import uic
from PyQt4.QtGui import QMenu, QAction, QCursor, QInputDialog

from qgis.gui import QgsMessageBar
from qgis.core import QgsRasterLayer, QgsVectorLayer
from qgis.utils import iface

from processing.gui.RectangleMapTool import RectangleMapTool
from processing.core.parameters import ParameterRaster
from processing.core.parameters import ParameterVector
from processing.core.parameters import ParameterMultipleInput
from processing.core.ProcessingConfig import ProcessingConfig
from import dataobjects

pluginPath = os.path.split(os.path.dirname(__file__))[0]
Expand Down Expand Up @@ -150,12 +152,22 @@ def useLayerExtent(self):
extents = [CANVAS_KEY]
layers = dataobjects.getAllLayers()
for layer in layers:
extentsDict[] = layer.extent()
authid =
if ProcessingConfig.getSetting(ProcessingConfig.SHOW_CRS_DEF) \
and authid is not None:
layerName = u'{} [{}]'.format(, authid)
layerName =
extentsDict[layerName] = {"extent": layer.extent(), "authid": authid}
(item, ok) = QInputDialog.getItem(self,'Select extent'),'Use extent from'), extents, False)
if ok:
if extentsDict[item]["authid"] != iface.mapCanvas().mapRenderer().destinationCrs().authid():
iface.messageBar().pushMessage("Warning"),"The projection of the chosen layer is not the same as canvas projection! The selected extent might not be what was intended."),
QgsMessageBar.WARNING, 8)

def selectOnCanvas(self):
canvas = iface.mapCanvas()
Expand Down

0 comments on commit c58981f

Please sign in to comment.