Skip to content
Browse files
Merge pull request #2505 from radosuav/processing_extent
[Processing] Check layer projection when using it for subset extent
  • Loading branch information
volaya committed Nov 27, 2015
2 parents 0a21d91 + c58981f commit 17e1bd6
Showing 1 changed file with 15 additions and 3 deletions.
@@ -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 17e1bd6

Please sign in to comment.