GRASS and Sextante: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
(updated)
(expanded)
Line 44: Line 44:
== How to use ==
== How to use ==


Note that GRASS is used in an internal temporary session (you cannot open GRASS data but work on GeoTIFF, SHAPE files etc).
Note that GRASS is used in an internal temporary session (so you cannot open GRASS data but work on GeoTIFF, SHAPE files using GRASS through gvSIG/Sextante).


A sample dataset is available here (based on free [http://www.grassbook.org/data_menu3rd.php North Carolina dataset], provided by B. Ducke):
=== Getting sample data ===
A sample dataset is available here (based on free [http://www.grassbook.org/data_menu3rd.php North Carolina dataset], packaged by B. Ducke):


   ftp://88.208.250.116/gvsig-ref-data-nc.zip
   ftp://88.208.250.116/gvsig-ref-data-nc.zip


Unpack the data set. It contains raster and vector map files.
Unpack the data set. It contains several raster and vector map files. The projection is ([http://spatialreference.org/ref/epsg/32119/ EPSG code 32119]).


Sample session:
=== Sample session ===
# Start a new project: "File" -> "New Project" -> Click on the new name -> "Open" button
# Start a new project: "File" -> "New Project" -> Click on the new name -> "Open" button
# Set the projection of the View: "View" -> "Properties" -> "Current projection" -> "Type:" select "EPSG" -> Enter code: "32119" -> Click on "Search" -> Click on "OK" -> Accept Properties with "OK"
# Set the projection of the View: "View" -> "Properties" -> "Current projection" -> "Type:" select "EPSG" -> Enter code: "32119" -> Click on "Search" -> Click on "OK" -> Accept Properties with "OK"
# Add raster/vector map(s) with the "Add layer" button (top menu, circa in the center): File -> "Add" -> Select file -> "OK"
 
# Zoom to map
==== Vector points map interpolation ====
# Add a vector points map with the "Add layer" icon (top menu): File -> "Add" -> Select file "geodetic_pts.shp" -> "OK"
# Zoom to a portion of the map
# Open Sextante dialog
# Go to "GRASS", expand "Vector (v.*)"
# Select "v.in.idw" (double click)
## The SHAPE file "geodetic_pts.shp" should be preselected. Enter as column name "elevation".
## Go to the region tab and select "Use extent from view".
## Enter "Cell size": 1000 (this is in map units, here: meters)
## Click "OK" to run the computation
# The resulting IDW interpolated raster map should appear in the view.
 
==== Raster map analysis: Create topographic index map from elevation map ====
# Add a raster elevation map with the "Add layer" icon (top menu): File -> "Add" -> Select File Type "Raster" -> Select file "north_carolina/wake/wake_elevation.tif" -> "OK"
# Zoom to map with right mouse button in the legend
# Open Sextante dialog
# Open Sextante dialog
# Go to "Indices and other hydrological parameters"
# Go to "GRASS", expand "Raster (r.*)"
# Go to "r.topidx"
# Start (double click) r.topidx, select as Input "Elevation", as output write "topidx.tif" (it will go into your current directory; check with browse button), click OK
# Start (double click) r.topidx, select as Input "Elevation", as output write "topidx.tif" (it will go into your current directory; check with browse button), click OK
# It should have generated a new map.
# It should have generated a new map which should appear in the view.


== See also ==
== See also ==

Revision as of 22:47, 15 April 2011

GRASS has been integrated into Sextante as extension. Sextante itself is commonly used within gvSIG. Through this integration, gvSIG users have access to the wealth of well tested algorithms provided by GRASS.

Note: the GDAL-GRASS plugin must be installed.

How to install (tuned OADE version)

  1. Download and install OADE gvSIG binaries from here

Since version gvSIG OA Digital Edition 2010 (1.0), Sextante 0.6 with integrated GRASS GIS support is included.

Alternative: How to install (original gvSIG version)

From gvSIG 1.10 onwards, Sextante with integrated GRASS GIS support is included:

  1. download gvSIG binaries from here (download the All-included version)
  2. run the installer
  3. start gvSIG

Activating GRASS GIS in Sextante

(modified after grass_sextante.html)

Configuring Sextante to use GRASS takes just a few easy steps. Once you have configured the system, you will be able to execute GRASS algorithms from any Sextante component like the toolbox or the graphical modeller, just like you do with any other Sextante geo-algorithm.

Only two parameters must be set, namely:

  • The path to the GRASS installation folder. It is needed by Sextante to execute GRASS commands.
  • The path to a GRASS mapset. The mapset doesn't have to contain any data at all, since data will be imported automatically each time you execute an algorithm. The only important part of the mapset is the location information, particularly the Coordinate Reference System. You must set the same CRS that is used by the layers that you want to process using GRASS algorithms. If, for instance, you have layers with data in the EPSG 23030 reference system, you must set the mapset to that same reference system. When data is imported into the mapset, no reprojection is performed, and layers are assumed to be in the same projection as the mapset itself.
  • Open the Sextante Toolbox icon
  • Go to Sextante settings (open icon -> right of the "Search" bar at bottom of the window)
  • Go to "GRASS"
  • Set therein
  GRASS folder: /path/to/grass-binary-installation/  (e.g., /usr/local/grass-6.4.0svn/ )
  GRASS mapset: /path/to/grassdata/location/mapset  (e.g., /home/neteler/grassdata/nc_spm_08/sextante ) The mapset doesn't have to contain any data at all!

Note: you need to create this mapset with GRASS

  grass64 -c /path/to/grassdata/location/mapset  (e.g., grass64 -c /home/neteler/grassdata/nc_spm_08/sextante )
  exit
  • Click on "Setup GRASS" to register the raster and vector commands
  • Now click on the "Help" button to know that it is there and what it contains
  • Finally click "OK" to leave the dialog. Now 5xx Sextante/GRASS commands should be available

How to use

Note that GRASS is used in an internal temporary session (so you cannot open GRASS data but work on GeoTIFF, SHAPE files using GRASS through gvSIG/Sextante).

Getting sample data

A sample dataset is available here (based on free North Carolina dataset, packaged by B. Ducke):

  ftp://88.208.250.116/gvsig-ref-data-nc.zip

Unpack the data set. It contains several raster and vector map files. The projection is (EPSG code 32119).

Sample session

  1. Start a new project: "File" -> "New Project" -> Click on the new name -> "Open" button
  2. Set the projection of the View: "View" -> "Properties" -> "Current projection" -> "Type:" select "EPSG" -> Enter code: "32119" -> Click on "Search" -> Click on "OK" -> Accept Properties with "OK"

Vector points map interpolation

  1. Add a vector points map with the "Add layer" icon (top menu): File -> "Add" -> Select file "geodetic_pts.shp" -> "OK"
  2. Zoom to a portion of the map
  3. Open Sextante dialog
  4. Go to "GRASS", expand "Vector (v.*)"
  5. Select "v.in.idw" (double click)
    1. The SHAPE file "geodetic_pts.shp" should be preselected. Enter as column name "elevation".
    2. Go to the region tab and select "Use extent from view".
    3. Enter "Cell size": 1000 (this is in map units, here: meters)
    4. Click "OK" to run the computation
  6. The resulting IDW interpolated raster map should appear in the view.

Raster map analysis: Create topographic index map from elevation map

  1. Add a raster elevation map with the "Add layer" icon (top menu): File -> "Add" -> Select File Type "Raster" -> Select file "north_carolina/wake/wake_elevation.tif" -> "OK"
  2. Zoom to map with right mouse button in the legend
  3. Open Sextante dialog
  4. Go to "GRASS", expand "Raster (r.*)"
  5. Go to "r.topidx"
  6. Start (double click) r.topidx, select as Input "Elevation", as output write "topidx.tif" (it will go into your current directory; check with browse button), click OK
  7. It should have generated a new map which should appear in the view.

See also