1

I have a raster file I need to clip. I created a virtual raster which I used to "copy" the extent from in QGIS raster calculator. As a result, I get the raster with the extent I need, but pixel size changes and it looks fuzzy compared with the original raster... Does anyone know how to avoid or correct this problem?

The first printscreen shows the original raster: The second printscreen shows the raster after beeing clipped:

4
  • 1
    How did you clip it? I would use GDAL_Translate -projwin (if you know the coordinates of the extents) or -srcwin (if you know rows/columns you need) to clip a raster, that will not affect the cellsize just the dimension. Apr 23, 2015 at 21:33
  • I tried it and it didn't change the cell size dimensions, but it gave me a different extents in each raster, even when I used the batch mode :(
    – Nadia
    Apr 23, 2015 at 23:49
  • So you have the same -projwin and you're getting different extents? Are the cell sizes for each raster the same? projwin uses some rounding to calculate a srcwin and then clips using that (you can see it when the tool runs) if you want exact cells try to work out minRow,minCol maxRow,maxCol and use -srcwin, that way you control implicitly which cells are in the output... it's a bit of work but it's worth it! Apr 24, 2015 at 0:26
  • Yes,I'm getting different extents and every raster has the same cell size. I will try to look on how to get the minRow,minCol maxRow,maxCol and keep trying. thanks!!
    – Nadia
    Apr 24, 2015 at 1:12

1 Answer 1

2

The easier way to use the Clip Tool in QGIS is by using the "extent clipping mode". For example, I want to clip the area represented by the shapefile in the next image:

enter image description here

With Raster -> Extraction -> Clipper, put the output name raster and select its area by drag on shapefile area. Then, click on Ok.

enter image description here

At the layer properties of the clipped raster you can observe that the X and Y pixel size is the same of the original raster (see below image). Furthermore, they are perfectly aligned (you can observe that with transparency at the first layer).

enter image description here

2
  • Por los printscreens veo que hablas español... intenté usar el clipper de esa manera anteriormente y no me funcionó... el extent de una de las capas quedo parecido pero no igual al de mi shape... estoy usando coordenadas geográficas y no UTM, crees que eso pueda ser un problema?
    – Nadia
    Apr 24, 2015 at 16:47
  • Yes, it could be the problem. You should use a projection in meters.
    – xunilk
    Apr 24, 2015 at 19:39

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.