1

I would like to create a vector grid over a raster layer, but with the grid being specifically only over the layer itself.

Right now, by using the vector grid option I'm getting a grid over a lot of unused space which is consuming considerable processing power and slowing down the work. Is it possible to create this grid but only over the parts of the raster that contain data?

Screenshot

1

If you want to limit the extent of the grid to the raster with data, you can do the following steps:

  • You need to convert the raster into polygon using Polygonize (raster to vector) tool from Processing toolbox -> GDAL/OGR -> [GDAL] Conversion -> Polygonize (raster to vector)
  • Start editing the polygon layer created in the previous step, select the polygon with Nodata and delete it, and save the edits
  • Create a polygon grid from Vector -> Research tools -> Vector grid
  • Use the Update extent from layer and and select the extent based on the polygon layer created above, and don't forget to select Output grid as polygon option.

enter image description here

The output grid should cover only the raster layer with data.

  • Thank you for your help! However, doing this is creating a grid in the same way it does with the raster. It doesn't limit its extent to the vector layer, it just covers the entire area with a grid. Any clues? – Ricardo Simões Dec 3 '17 at 17:57
  • Do you need the black pixels area around the other pixel information (gray level colors). If yes, then nothing will change whether you converted the raster to polygon or not. However, if you don't need the black pixels area then converting raster to polygon an deleting this part will reduce the extent to the pixels with data. – ahmadhanb Dec 4 '17 at 3:06
0

If you try to make a grid using the link below, after you have the layer grid, clip after raster, but try to make a boundary layer (vector) from your raster and after all use clip extension.

Creating fishnet grid Shapefile in QGIS?

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.