<div dir="ltr"><div>I believe you should check what is inside my_input_raster_layer, there should be a path to a input raster file like<br><br></div>gdal.Warp("output.tif", "input.tif", options=options)</div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Fri, Oct 3, 2025 at 7:44 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">Hi Nyall,<br>
It was a typo (pretty clumsy at my end) as it should have read <br>
'my_input_raster_layer' rather than 'my_input_vector_layer.' The <br>
source/input layer is a raster.<br>
Thanks.<br>
<br>
On 2025-10-03 21:30, Nyall Dawson wrote:<br>
> On Sat, 4 Oct 2025, 2:00 am AF via gdal-dev,<br>
> <<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>> wrote:<br>
> <br>
>> Hello,<br>
>> A PyQGIS code needs to reproject one raster layer from a CRS to a<br>
>> new<br>
>> one. To begin with, I've tried to use only the minimal required<br>
>> options<br>
>> so the snippet reads:<br>
>> parameters = {<br>
>> 'INPUT': my_input_vector_layer,<br>
> <br>
> Not sure if this is a typo (or a badly named variable, or ai slop<br>
> code), but it looks like you're trying to warp a vector later to a<br>
> raster layer? 🤔<br>
> <br>
> Nyall<br>
> <br>
>> 'SOURCE_CRS':<br>
>> QgsCoordinateReferenceSystem(source_PROJ),<br>
>> 'TARGET_CRS':<br>
>> 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',<br>
>> parameters)<br>
>> However, this doesn't do much as terrain is simply a dictionary with<br>
>> the<br>
>> keyword 'OUTPUT' and my_new_raster.tif is never created. Obviously I<br>
>> <br>
>> must be doing something wrong and suspect that might be related to<br>
>> 'OUTPUT'. The documentation at<br>
>> <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>
>> <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>
>> <br>
>> sure if this method is preferable to using processing.run) but it<br>
>> keeps<br>
>> saying that it only takes 2 arguments. I found a few examples online<br>
>> 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<br>
>> 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>
_______________________________________________<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>