Can not seem to figure out this problem when i am running Clip Raster by Mask Layer function:

> INFO gdalwarp -of GTiff -cutline "C:/Users/user/Downloads/gis files/final 23.05.2020.shp" -cl "final 23.05.2020" -crop_to_cutline crs=EPSG:3857&format&type=xyz&url=https://tile.openstreetmap.org/%7Bz%7D/%7Bx%7D/%7By%7D.png&zmax=19&zmin=0 "C:/Users/user/Downloads/gis files/tst.tif" 2020-05-23T18:09:16 INFO GDAL execution console output

         FAILURE: No target filename specified.

         Usage: gdalwarp [--help-general] [--formats]

          [-s_srs srs_def] [-t_srs srs_def] [-to "NAME=VALUE"]* [-novshiftgrid]

          [-order n | -tps | -rpc | -geoloc] [-et err_threshold]

          [-refine_gcps tolerance [minimum_gcps]]

          [-te xmin ymin xmax ymax] [-tr xres yres] [-tap] [-ts width height]

          [-ovr level|AUTO|AUTO-n|NONE] [-wo "NAME=VALUE"] [-ot Byte/Int16/...] [-wt Byte/Int16]

          [-srcnodata "value [value...]"] [-dstnodata "value [value...]"] -dstalpha

          [-r resampling_method] [-wm memory_in_mb] [-multi] [-q]

          [-cutline datasource] [-cl layer] [-cwhere expression]

          [-csql statement] [-cblend dist_in_pixels] [-crop_to_cutline]

          [-of format] [-co "NAME=VALUE"]* [-overwrite]

          [-nomd] [-cvmd meta_conflict_value] [-setci] [-oo NAME=VALUE]*

          [-doo NAME=VALUE]*

          srcfile* dstfile

         Available resampling methods:

          near (default), bilinear, cubic, cubicspline, lanczos, average, mode, max, min, med, Q1, Q3.

         Required parameter missing -

         The system cannot find the file specified.

         'url' is not recognized as an internal or external command,

         operable program or batch file.

         'zmax' is not recognized as an internal or external command,

         operable program or batch file.

         'zmin' is not recognized as an internal or external command,

         operable program or batch file.
  • Not sure if you can consider XYZ tiles as rasters. That's probably why it's not working Commented May 23, 2020 at 19:59
  • Isn't the base-map a raster file? Embarrassed. What i am trying to accomplish is the equivalent of "clip to extent" available in arcgis.
    – rexhepib
    Commented May 27, 2020 at 8:23
  • Wondering if anyone could help on this? Is there another way to make this happen? Basically, i just want the basemap to only show on the background of the area covered by "Komunat_Finale" polygon: ibb.co/j5XKfvw
    – rexhepib
    Commented May 28, 2020 at 12:57
  • Is this for display purposes only? Duplicate polygon layer and use a inverted polygon renderer on top of the basemap to mask it. Commented May 28, 2020 at 13:34
  • @AlexandreNeto Yes, for display purposes only. Could you please elaborate how i can use that feature, or kindly lead me to some guides?
    – rexhepib
    Commented May 28, 2020 at 13:47

1 Answer 1


Having a vector layer with a polygon, you can use it to visually mask other layers. Open the layer styling panel (F7)

enter image description here

Click the symbol render option.

enter image description here

Select the inverted polygons option. Then choose the make color. In this case I choose white and no stroke. enter image description here

  • Thanks so much @Alexandre Neto! This worked perfectly.
    – rexhepib
    Commented Jun 1, 2020 at 10:16
  • What about is not for Visual only, but rather want to save a clipped raster as .tif? Commented Nov 4, 2022 at 0:01
  • 1
    Please disregard the previous comment, I worked this out. For others trying to do this: 'Export' - 'Save As' ... the placed XYZ layer as a Rendered Image, (don't check 'Create VRT'), set the extent to whatever works for your purpose, map canvas or a 'create from layer' (ie. the eventual mask poly), set resolution to hor-10 x vert-10, then Run. Now you can clip the new .tif with 'Raster' + 'Extraction',+ 'Clip Rater by Mask Layer'. Commented Nov 4, 2022 at 0:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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