Thursday, 29 March 2012

Clear R Command Window


If you've ever used matlab this function does the same as clc. I've see a whole lot of function writing which I tried and couldn't get to work, then found a comment saying...
"doesn't ctrl+l do that for you?". Love it!

Sunday, 25 March 2012

Cell Statistics (e.g. mean or standard deviation across rasters) ( requires Spatial Analyst extension)

“Cell Statistics” is a function from the Spatial Analyst that allows you to calculate several statistical operations as derived from multiple rasters, i.e: minimum, maximum, mean, range, sum, standard deviation or median values of each grid from a group of rasters. The output is a new raster containing the statistic result for each cell corresponding to the calculation which has been derived from the specified cells beneath it. E.g. This is often used when trying to create a standard deviation map from e.g. 10 build models in order to provide spatially relevant values of variance (i.e. a map of error margins).

  1. Go to "Cell Statistics" in the drop down menu from the Spatial Analyst toolbar
  2. Add the relevant raster layers you would like the calculation to include to the right-hand pane
  3. Select the statistic you wish to calculate and press ok.
  4. (if the output is only temporary you must also make this permanent. See merging rasters step 10 for how to do this)

Merging Rasters (requires Spatial Analyst extension)

  1. Go to the options of the Spatial Analyst (from the Spatial Analyst toolbar drop down menu)
  2. Set the Extent to "Union of Inputs"
  3. Choose the cell size (can be same as another raster or typed in manually) then exit the options.
  4. Go to the Raster Calculator (also from the Spatial Analyst toolbar drop down menu).
  5. Type... MERGE (
  6. Double click on the rasters you want to merge separating the inserted text by commas then close the brackets
  7. IMPORTANT ensure that the cursor is then moved back a space so that it is flashing within the brackets! This operation usually does not complete if the cursor is outside the brackets.
  8. Click "Evaluate"
  9. A new temporary raster is generated and appears in the Layers pane.
  10. If you are happy with this new raster make the temporary raster permanent by right clicking on the raster in the Layers pane, selecting "data >" and then "Make permanent". Give your new raster a name and location and click save, then add it to your map if you wish to complete any further tasks with this raster.
NOTE: The order of priority when merging rasters is determined by the order in which the layers are selected in the raster calculator. The first raster you select whilst merging defines the settings which the output raster will default to (e.g. projection). All subsequent rasters when merged will conform to these settings.

Friday, 23 March 2012

Clipping Rasters - Raster Calculator Method (requires Spatial Analyst extension)

  1. Go to the options of the Spatial Analyst (drop down menu on toolbar - you may have to activate this toolbar first)
  2. In the "General" tab set the "Analysis Mask" as the smallest raster. You'll cut the rasters with the shape of the "Analysis Mask".
  3. In the "Extent" tab set the extent as the same layer as the "Analysis Mask"
  4. Choose the cell size in the "Cell Size" tab and close the options menu.
  5. Go to the raster calculator (also in the drop down menu on the spatial analyst toolbar)
  6. Double click the raster you want to clip and press the "Evaluate"

NOTE you can only clip rasters one by one.