2

I have polygon grid layer and raster image whitch want to split with my grid layer to have 9 new raster layers.

I was doing it like this guy but my QGIS stop working and shut down every time when I hit run button.

So is there another way, how to split raster with vector layer?

  • Why not clipper? Nine are not many raster and it is easy to do that. – xunilk Oct 18 '15 at 12:59
  • So there is another way? – ABCD Oct 18 '15 at 13:29
  • Clipper is based in gdal_translate. You can use it directly in a python script. – xunilk Oct 18 '15 at 17:09
  • Yes, but I have tried to use cliper with my grid layer..result was one black raster. – ABCD Oct 18 '15 at 17:11
  • I had an answer based in clipper but you edited your question to put "without clipper". It works. – xunilk Oct 18 '15 at 17:14
5

There's a QGIS plugin called GridSplitter which will take a raster (or vector layer for that matter) and split it up into one raster layer per grid cell. If you already have a grid polygon layer you can use that to cut up the image, using the 'cut layer' option (see screenshot)

This is probably the easiest way to do this, especially if you need to scale this up (e.g. split a world DEM into degree squares)

enter image description here

0

You can use the approach that I have used with these raster and grid vector layer of next image. First, select the element to clip with "Select features by area or single click" at the grid vector layer. At the attributes table of grid layer, click in "Show selected features" option (at the bottom) and next, at the record, click with right button of the mouse for selecting "Open Form". Copy to your favorite text editor the extent parameters in this order: X_MIN, Y_MAX, X_MAX, Y_MIN (see next image).

enter image description here

Open Clipper Tool in Raster -> Extraction -> Clipper. Select the name of output file, and drag with the mouse one arbitrary area on the map and click on the icon pencil for editing gdal_translate command. Change projwin parameters for the values at your text editor (copy/paste).

enter image description here

After OK, the clipped image it will have the same resolution of raster base; as it can be observed at next image.

enter image description here

  • Right now I am on phone. I will try it when I get back, for now THANKS! – ABCD Oct 18 '15 at 17:18
0

There is yet another way (of course):

Right-click your raster in Layers. Select Export->Save As... and click the little Create VRT checkbox to the right of Format option drop-down. This then opens a previously hidden VRT Tiles options section in th dialog (below 'Resolution'). You can set the columns and rows (tile size e.g. 512x512). The file name is the folder where all the tiles wil be stored.

The nice thing about this approach is you automatically get a VRT xml file too, ready to go.

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.