Skip to content
Browse files

[Processing] Check layer projection when using it for subset extent

  • Loading branch information
radosuav committed Nov 26, 2015
1 parent da4fe7e commit c58981fd5ede0c66dc0b4d9eb8f757126166374e
Showing with 15 additions and 3 deletions.
  1. +15 −3 python/plugins/processing/gui/
@@ -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]
@@ -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()

0 comments on commit c58981f

Please sign in to comment.
You can’t perform that action at this time.