In QGIS 3.4.6, I tried to select an area from a raster map, to use the cropped area as a new layer or export the cropped area as a GeoTIFF.

I'm trying to use "Raster/Extraction/Clip Raster by Extent", but even with default settings, it fails.

This should be one of the most basic functionality, but I havent found examples or doku on how to extract/crop raster layers with this menu option.

"Clipping extent" was created by using "Select Extent from canvas".

But, even when using the dafault seetings from the dialogue, the gdal tranformation fails.

If I run the gdal code in the commandline, GDAL fails.

FAILURE: No target dataset specified
Processing algorithm…
Algorithm 'Clip raster by extent' starting…
Input parameters:
{ 'DATA_TYPE' : 0, 'INPUT' : 'type=xyz&url=https://mt1.google.com/vt/lyrs%3Ds%26x%3D%7Bx%7D%26y%3D%7By%7D%26z%3D%7Bz%7D&zmax=18&zmin=0', 'NODATA' : None, 'OPTIONS' : 'COMPRESS=JPEG|JPEG_QUALITY=75', 'OUTPUT' : '/home/vmuser/QA_DOKS/tester.tif', 'PROJWIN' : '952408.1511424138,960335.9112865862,7074131.045407576,7079189.42967867 [EPSG:3857]' }GDAL command:
gdal_translate -projwin 952408.1511424138 7079189.42967867 960335.9112865862 7074131.045407576 -of GTiff -co COMPRESS=JPEG -co JPEG_QUALITY=75 type=xyz&url=https://mt1.google.com/vt/lyrs%3Ds%26x%3D%7Bx%7D%26y%3D%7By%7D%26z%3D%7Bz%7D&zmax=18&zmin=0 /home/vmuser/QA_DOKS/tester.tif
GDAL command output:
/bin/sh: 1: /home/vmuser/QA_DOKS/tester.tif: not foundFAILURE: 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][-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_datasetExecution completed in 0.13 seconds
{'OUTPUT': '/home/vmuser/QA_DOKS/tester.tif'}Loading resulting layers
The following layers were not correctly generated.<ul><li>/home/vmuser/QA_DOKS/tester.tif</li></ul>You can check the 'Log Messages Panel' in QGIS main window to find more information about the execution of the algorithm.

You are trying to clip google map service layer which is not possible, only rasters. You could "print screen" part you need or create layout and select "Save world file" on layout properties to get georeferenced portion of map: enter image description here

Some map services have limitations on export resolution and get shifted or deformed in some other way when using above the limitation resolution. Think last time i tried google maps it was 150 DPI.

| improve this answer | |

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.