1

I do have a NUTS-2 region shapefile as you can see below enter image description here

and a raster (.tif) file that represents the soil erosion (tonnes per hectare per year) derived from the RUSLE2015 model.

What I want is to clip the raster according to the extent of the shapefile. However, when I used the clip and extract by mask tools by also specifying different parameters and values in the enviroments (e.g. processing extent) the final output is as follows: enter image description here

As I know and show in several similar questions in GIS Stack exchange, this is common to happen as a raster is a kind of matrix which is composed by n rows and m columns, so the extent of it is rectungular. The reddish area are pixels without values so you only have valid pixels in the extent of the shapefile.

By considering the rationality behind this problem, I need to find a solution to avoid the NoData values surrounding the preferred extent as my tif file has already NoData values inside the shapefile extent from which I would like to derive some statistics and information (e.g. area).

Can you think of any way to solve this problem?

Should it be converted to another format?

3
  • If you also wish to ask about how to do this using software other than ArcMap then please do that using separate questions.
    – PolyGeo
    Jul 16, 2021 at 16:54
  • Extract by mask and clip are different. Uncheck using geometry in clip or compute envelope of polygon using minimum bounding geometry. Simplest- set extent equal to one of polygon and run orig.raster through calculator.
    – FelixIP
    Jul 16, 2021 at 21:48
  • @FelixIP I tried but it didn't work. I have utilized several environment settings but I cannot get rid of the NoData values. I assume this has to do because of the tif format of my raster. If you think of any other solution please let me know. Thank you very much. Jul 23, 2021 at 13:13

2 Answers 2

1

Originally I was going to suggest you could recoded the nodata cells that lie out side your NUTS2 polygon to some other value that is outside your data range for your soils data. As these are in tonnes per hectare per year, something like -1 would be sufficient? The limitation with this approach is that you always have to somehow exclude from your processing any values that are -1.

It then occurred to me that all you really need to do is apply a mask when you run a geoprocessing tool. This has the effect of saying "only process cells within this area". This would be the smartest approach.

You can convert your polygon dataset to a simple raster making sure you have set the snap raster environment setting to ensure correct alignment. You use that in every tool that honours the mask setting.

1
  • I applied a mask and so on and use the snap raster setting along with the processing extent settings but it does not work. =/ If I reclassify the raster and display NoData values as e.g. -1 I will have a problem with the NoData values inside the preferable extent. I might reclassify them though and delete manually the -1 polygons outside the preferred extent. If you think of any other solution please let me know. Thank you. Jul 23, 2021 at 13:15
1

Finally I found the answer.

You can use the Raster Calculator tool with the algebra expression displayed below enter image description here

Then the result tiff has two values. 0 for the non null values and 1 for the NoData values inside the specified processing extent. (Environment settings used are processing extent (specified shapefile) and snap raster, mask).

As such the resulting tif enter image description here

has still NoData values outside the specified polygon extent but this is no problematic if you want to derive information about the NoData values inside the specified extent as now they are being displayed with the value of 1.

Hope the answer will be helpful.

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.