2

I am using QGIS 3.10.2 and I am trying to clip a raster layer of the World just to capture Africa. The raster layer was imported from ESRI (https://planet.qgis.org/planet/tag/world%20imagery/) with the following code in the Python console:

qgis.utils.iface.addRasterLayer("http://server.arcgisonline.com/arcgis/rest/services/ESRI_Imagery_World_2D/MapServer?f=json&pretty=true","raster")

Now I click on Raster>Extraction>Cut by Extent, I select my Entry layer. I chose to select on Canvas the extent, draw a polygon and obtain the coordinates. Last, I select the output file. Here is what it looks like (sorry in Spanish)

enter image description here

I click execute and I get the following error:

Versión de QGIS: 3.10.2-A Coruña
Revisión del código de QGIS: d4cd3cfe5a
Versión de Qt: 5.11.2
Versión de GDAL: 3.0.3
Versión de GEOS: 3.8.0-CAPI-1.13.1 
Versión de PROJ: Rel. 6.3.0, January 1st, 2020
Procesando algoritmo...
Algoritmo 'Cortar ráster por extensión' comenzando…
Input parameters:
{ 'DATA_TYPE' : 0, 'EXTRA' : '', 'INPUT' : 'http://server.arcgisonline.com/arcgis/rest/services/ESRI_Imagery_World_2D/MapServer?f=json&pretty=true', 'NODATA' : None, 'OPTIONS' : '', 'OUTPUT' : 'C:/Users/Javier.DESKTOP-EEJENVF/Documents/fires/cut1.tif', 'PROJWIN' : '-21.94386249283079,56.234657100783124,-39.64277198356078,36.88988403966126 [EPSG:4326]' }

GDAL command:
gdal_translate -projwin -21.94386249283079 36.88988403966126 56.234657100783124 -39.64277198356078 -of GTiff http://server.arcgisonline.com/arcgis/rest/services/ESRI_Imagery_World_2D/MapServer?f=json&pretty=true C:/Users/Javier.DESKTOP-EEJENVF/Documents/fires/cut1.tif
GDAL command output:


FAILURE: No target dataset specified.

Usage: gdal_translate [--help-general] [--long-usage]

[-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/

CInt16/CInt32/CFloat32/CFloat64}] [-strict]

[-of format] [-b band] [-mask band] [-expand {gray|rgb|rgba}]

[-outsize xsize[%]|0 ysize[%]|0] [-tr xres yres]

[-r {nearest,bilinear,cubic,cubicspline,lanczos,average,mode}]

[-unscale] [-scale[_bn] [src_min src_max [dst_min dst_max]]]* [-exponent[_bn] exp_val]*

[-srcwin xoff yoff xsize ysize] [-epo] [-eco]

[-projwin ulx uly lrx lry] [-projwin_srs srs_def]

[-a_srs srs_def] [-a_ullr ulx uly lrx lry] [-a_nodata value]

[-a_scale value] [-a_offset value]

[-nogcp] [-gcp pixel line easting northing [elevation]]*

|-colorinterp{_bn} {red|green|blue|alpha|gray|undefined}]

|-colorinterp {red|green|blue|alpha|gray|undefined},...]

[-mo "META-TAG=VALUE"]* [-q] [-sds]

[-co "NAME=VALUE"]* [-stats] [-norat]

[-oo NAME=VALUE]*

src_dataset dst_dataset

"pretty" no se reconoce como un comando interno o externo,

programa o archivo por lotes ejecutable.

Execution completed in 0.30 seconds
Results:
{'OUTPUT': 'C:/Users/Alum.DESKTOP-EEJENVF/Documents/fires/cut1.tif'}

Apparently the problem is that I did not specify a target dataset.

Can anyone help me?

2 Answers 2

2

Alum.DESKTOP-EEJENVF looks like a bad choice for an output path. The dot in the folder name may throw off some tools. Try something simple like C:\temp\cut1.tif instead.

0

I recently encountered the same problem and it turned out that, as opposite to what error message says, the problem is with input path, not target path. For rasters that are not local (i.e. web services) it is necessary to add quotes/double quotes (at least in Linux) for the gdal_translate to work properly. As I don't know how to enforce it in QGIS, I'm just copying the gdal line to Linux terminal (again - not tested in Windows CMD - but should be similar) and adjust it there. So the example line looks like this:

gdal_translate -projwin 0.0940291840174973 52.20722002141618 0.1427988970615623 52.19080241917401 -of GTiff "http://server.arcgisonline.com/arcgis/rest/services/ESRI_Imagery_World_2D/MapServer?f=json&pretty=true" /home/usr/Documents/GIS/QGISRasterScreenshot_modified_crop2.tif  

In my case there is no need to put quotes to output (although in user2891698 case, if he sees the answer after so many months, it might be necessary due to the dot in the path, as underdark suggested)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.