Clip a raster leaving out 'no data'

2953
2
Jump to solution
07-20-2018 03:39 AM
AmericaZelada
New Contributor II

Hello, 

I have a big raster A (9000 x 2000 pixels) and I want to clip out a small portion of it B (500 x 500 pixels).

When I do this using EXTRACT BY MASK, the result raster C is still 9000 x 2000 pixels with only the small B portion containing data and the rest with 'no data' cells.

So I can 'hide' the border and it's fine if all I wanted was to make maps. However, I am looking to export the matrix into Matlab for further processing, and this issue not only makes the file unnecessarily bigger but also when exporting as a .tif it adds a white border to it.

I've seen this issue asked in many forums, since many years, but I can't find a definitive answer (or at least one that works at all for me).

Could you please help?

Many thanks

Ame

0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Esteemed Contributor

what you want is...

Clip—Data Management toolbox | ArcGIS Desktop 

see the image there as an example

Alternately, if you know the physical extent of the area you want, you can set it prior to using a copy raster

Note... you can also clip the raster, and the mask prior to performing extract by mask.

Just make sure that you specify the exact same cell size, extent and snap raster.

View solution in original post

2 Replies
DanPatterson_Retired
MVP Esteemed Contributor

what you want is...

Clip—Data Management toolbox | ArcGIS Desktop 

see the image there as an example

Alternately, if you know the physical extent of the area you want, you can set it prior to using a copy raster

Note... you can also clip the raster, and the mask prior to performing extract by mask.

Just make sure that you specify the exact same cell size, extent and snap raster.

AmericaZelada
New Contributor II

Thanks Dan, 

I had tried this before, but I was specifying the extent with a rectangular polygon. When doing this it adds an odd border around the polygon I realised (why? don't know...) 

So I got the vertices' coordinates from my rectangular polygon and used them instead.

I made sure I snapped the raster (they where already same cell size), and yeah 'No data' cells are not there any longer .

You have made my life better

Thanks again

Ame