mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
54 lines
2.3 KiB
Diff
54 lines
2.3 KiB
Diff
diff --git a/gdal/warp.py b/gdal/warp.py
|
|
index 5dac040..b4f1eee 100644
|
|
--- a/gdal/warp.py
|
|
+++ b/gdal/warp.py
|
|
@@ -23,14 +23,16 @@
|
|
# This will get replaced with a git SHA1 when you do a git archive
|
|
__revision__ = '$Format:%H$'
|
|
|
|
+import os
|
|
+from qgis.core import *
|
|
from PyQt4 import QtGui
|
|
from sextante.core.GeoAlgorithm import GeoAlgorithm
|
|
from sextante.parameters.ParameterRaster import ParameterRaster
|
|
from sextante.outputs.OutputRaster import OutputRaster
|
|
-import os
|
|
-from qgis.core import *
|
|
from sextante.parameters.ParameterSelection import ParameterSelection
|
|
from sextante.parameters.ParameterCrs import ParameterCrs
|
|
+from sextante.parameters.ParameterString import ParameterString
|
|
+from sextante.parameters.ParameterNumber import ParameterNumber
|
|
from sextante.gdal.GdalUtils import GdalUtils
|
|
|
|
class warp(GeoAlgorithm):
|
|
@@ -41,6 +43,8 @@
|
|
DEST_SRS = "DEST_SRS "
|
|
METHOD = "METHOD"
|
|
METHOD_OPTIONS = ["near", "bilinear", "cubic", "cubicspline", "lanczos"]
|
|
+ EXTRA = "EXTRA"
|
|
+ TR = "TR"
|
|
|
|
def getIcon(self):
|
|
filepath = os.path.dirname(__file__) + "/icons/warp.png"
|
|
@@ -52,7 +56,9 @@
|
|
self.addParameter(ParameterRaster(warp.INPUT, "Input layer", False))
|
|
self.addParameter(ParameterCrs(warp.SOURCE_SRS, "Source SRS (EPSG Code)", "4326"))
|
|
self.addParameter(ParameterCrs(warp.DEST_SRS, "Destination SRS (EPSG Code)", "4326"))
|
|
+ self.addParameter(ParameterNumber(warp.TR, "Output file resolution in target georeferenced units (leave 0 for no change)", 0.0, None, 0.0))
|
|
self.addParameter(ParameterSelection(warp.METHOD, "Resampling method", warp.METHOD_OPTIONS))
|
|
+ self.addParameter(ParameterString(warp.EXTRA, "Additional creation parameters"))
|
|
self.addOutput(OutputRaster(warp.OUTPUT, "Output layer"))
|
|
|
|
def processAlgorithm(self, progress):
|
|
@@ -68,6 +74,10 @@
|
|
commands.append("-of")
|
|
out = self.getOutputValue(warp.OUTPUT)
|
|
commands.append(GdalUtils.getFormatShortNameFromFilename(out))
|
|
+ if str(self.getParameterValue(warp.TR)) != "0":
|
|
+ trStr = "-tr "+str(self.getParameterValue(warp.TR))+" "+str(self.getParameterValue(warp.TR))
|
|
+ commands.append(trStr)
|
|
+ commands.append(str(self.getParameterValue(warp.EXTRA)))
|
|
commands.append(self.getParameterValue(warp.INPUT))
|
|
commands.append(out)
|
|
|