<div dir="ltr"><div><div><div>Hi, <br></div>I don't really know what you are trying to do with a vector layer as input for gdal.Warp as it is used more like a cutline to clip a raster rather as an input, as gdal.Warp expects a raster input/output but<br></div>to make it work you must pass options as keyword argument, not as positional argument, like bellow:<br><br>warp = gdal.Warp('/home/ubuntu/pepe.tif', my_input_vector_layer, options=options)<br><br></div>Hope it helps!<div><br><br></div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Fri, Oct 3, 2025 at 1:01 PM AF via gdal-dev <<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello,<br>
A PyQGIS code needs to reproject one raster layer from a CRS to a new <br>
one. To begin with, I've tried to use only the minimal required options <br>
so the snippet reads:<br>
             parameters = {<br>
                 'INPUT': my_input_vector_layer,<br>
                 'SOURCE_CRS': QgsCoordinateReferenceSystem(source_PROJ),<br>
                 'TARGET_CRS': QgsCoordinateReferenceSystem(target_PROJ),<br>
                 'RESAMPLING': 1,<br>
                 'DATA_TYPE': 4,<br>
                 'OUTPUT': '/home/ubuntu/my_new_raster.tif'<br>
                 }<br>
             terrain = processing.run('gdal:warpreproject', parameters)<br>
However, this doesn't do much as terrain is simply a dictionary with the <br>
keyword 'OUTPUT' and my_new_raster.tif is never created. Obviously I <br>
must be doing something wrong and suspect that might be related to <br>
'OUTPUT'. The documentation at <br>
<a href="https://docs.qgis.org/testing/en/docs/user_manual/processing/toolbox.html#output-parameter-widget" rel="noreferrer" target="_blank">https://docs.qgis.org/testing/en/docs/user_manual/processing/toolbox.html#output-parameter-widget</a> <br>
didn't dissipate my doubts so I'm unsure how to proceed.<br>
I also tried (an alternative method) calling gdal.Warp directly (not <br>
sure if this method is preferable to using processing.run) but it keeps <br>
saying that it only takes 2 arguments. I found a few examples online but <br>
they all have more than 2 arguments. For example<br>
             options = gdal.WarpOptions(dstSRS=target_PROJ)<br>
             warp = gdal.Warp('/home/ubuntu/pepe.tif', <br>
my_input_vector_layer, options)<br>
             warp = None<br>
complains about including 3 and not 2 arguments. Same if I try including <br>
all arguments at warp.<br>
Thanks.<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</blockquote></div>