User Tools

Site Tools


We propose below a few examples of how to start a new grass project.

Using Grass GUI

Open a terminal and type

grass70 -gui

and follow this guide.

Using a bash script and a map

The bash script: ~/ost4sem/exercise/basicadvgrass/ allows to automatically create a new Grass working environment using projection parameters defined in an existing map.
See this wiki page for details on how to use the script.

Using Qgis GUI

To easily create a new GRASS working directory (DBASE, LOCATION, MAPSET), we can use Qgis.
See Quantum gis.

A new Location within an an existing DB

If you previously have created a grassdb and a location, you can enter in your existing grass mapset and create a new location using a GDAL / OGR import functions. input=input_raster output=output_GRASS_raster location=new_Location --overwrite dsn=input_vector output=output_GRASS_vector location=new_Location  --overwrite 

A new Mapset within an an existing Location

From GRASS 6.4 a -c flag option allow to use g.mapset to create a new mapset

g.mapset mapset=NEW_MAPSET_NAME -c

To generate a new Mapset from a pre-existing location you can also copy the PERMANENT folder and rename it.

 cp -r PERMANENT NEW_Mapset

Then you start grass in the NEWMapset directory environment grass62 -text /home/user/ots4sem/studycase/ITAveg/grassdata/NEW_Mapset


Using this procedure allows you to learn grass using template dataset spearfish and follow instructions available in grass manual.
The general procedure consists of the following steps:

  • Creating a new empty directory to use as GISDBASE.
  • Dwnload and move the demo dataset inside the new GISDBASE
  • Import a vector or raster map using GDAL/OGR functions and create a new location while importing grass dataset (including a location and a mapset) inside. Several template datasets exists. Very common is the spearfish DB. (~20MB)
mkdir ~/ost4sem/tmp
cd ~/ost4sem/tmp
mkdir ~/ost4sem/new_grass_DBASE
mv ~/ost4sem/new_grass_DBASE/
cd ~/ost4sem/new_grass_DBASE
rm -r ~/ost4sem/tmp
rm -f
grass -text ~/ost4sem/new_grass_DBASE/spearfish60/PERMANENT input=~/ost4sem/exercise/basic_adv_grass/inputs/lc_cor2000/hdr.adf  output=landcover location=new_Location --overwrite 
# or if you use a vector
# dsn=~/ost4sem/exercise/EUforest_stats/EU_country_gl_gpwc3/EU_country_gpwv3.shp output=world_country location=new_Location
rm -r ~/ost4sem/new_grass_DBASE/spearfish60/

As a result we will have generated:

  • a new grass GISDBASE: “newgrassDBASE”
  • a new Location setted with the projection and extent of the map we wanted to open: “new_Location”
  • a new PERMANENT Mapset inclusive of the raster or vector map we opened.
wiki/grass_newproject.txt · Last modified: 2017/12/05 22:53 (external edit)