grass7.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. <!-- meta page description: GRASS startup program -->
  2. <h2>SYNOPSIS</h2>
  3. <b>grass70</b> [<b>-h</b> | <b>-help</b> | <b>--help</b>] [<b>-v</b> | <b>--version</b>]
  4. [<b>-c</b> | <b>-c geofile</b> | <b>-c EPSG:code</b>]
  5. [<b>-text</b> | <b>-gtext</b> | <b>-gui</b>]
  6. [[[<b>&lt;GISDBASE&gt;/</b>]<b>&lt;LOCATION_NAME&gt;/</b>]
  7. <b>&lt;MAPSET&gt;</b>]
  8. <h3>Flags:</h3>
  9. <dl>
  10. <dt><b>-h</b> | <b>-help</b> | <b>--help</b>
  11. <dd> Prints a brief usage message and exits
  12. <dt><b>-v</b> | <b>--verbose</b>
  13. <dd> Prints the version of GRASS and exits
  14. <dt><b>-c</b>
  15. <dd> Creates new GRASS unprojected location in specified GISDBASE
  16. <dt><b>-c geofile</b>
  17. <dd> Creates new GRASS projected location in specified GISDBASE based on georeferenced file
  18. <dt><b>-c EPSG:code</b>
  19. <dd> Creates new GRASS projected location in specified GISDBASE with given EPSG code
  20. <dt><b>-text</b>
  21. <dd> Indicates that Text-based User Interface should be used (skip welcome screen)
  22. <dt><b>-gtext</b>
  23. <dd> Indicates that Text-based User Interface should be used (show welcome screen)
  24. <dt><b>-gui</b>
  25. <dd> Indicates that Graphical User Interface
  26. (<em><a href="wxGUI.html">wxGUI</a></em>) should be used
  27. </dl>
  28. <h3>Parameters:</h3>
  29. <dl>
  30. <dt><b>GISDBASE</b>
  31. <dd> Initial database directory which should be a fully qualified path
  32. (e.g., <tt>/usr/local/share/grassdata</tt>)
  33. <dt><b>LOCATION_NAME</b>
  34. <dd> Initial location directory which is a subdirectory of GISDBASE
  35. <dt><b>MAPSET</b>
  36. <dd> Initial mapset directory which is a subdirectory of LOCATION_NAME
  37. </dl>
  38. <i>Note</i>: These parameters must be specified in one of the
  39. following ways:
  40. <pre>
  41. MAPSET
  42. LOCATION_NAME/MAPSET
  43. GISDBASE/LOCATION_NAME/MAPSET
  44. </pre>
  45. <h2>DESCRIPTION</h2>
  46. <p>This command is used to launch GRASS GIS. It will parse the command
  47. line arguments and then initialize GRASS for the user. Since GRASS
  48. modules require a specific environment, this program must be called
  49. before any other GRASS module can run. The command line arguments are
  50. optional and provide the user with a method to indicate the desired
  51. user interface, as well as the desired mapset to work on.
  52. <p>The startup program will remember both the desired user interface
  53. and mapset. Thus, the next time the user runs GRASS, typing
  54. <em>grass70</em> (without any options) will start GRASS with the
  55. previous settings for the user interface and mapset selected.
  56. <p>If you specify a graphical user interface (<b>-gui</b>)
  57. the <em>grass70</em> program will try to verify that the system you
  58. specified exists and that you can access it successfully. If any of
  59. these checks fail then <em>grass70</em> will automatically switch back
  60. to the text user interface mode.
  61. <h2>ENVIRONMENT VARIABLES</h2>
  62. A number of environment variables are available at GRASS startup to
  63. assist with automation and customization. Most users will not need to
  64. bother with these.
  65. <p>In addition to these shell environment variables GRASS maintains a
  66. number of GIS environment variables in the <tt>$HOME/.grass7/rc</tt>
  67. file. User changes to this file will be read during the next startup
  68. of GRASS. If this file becomes corrupted the user may edit it by hand
  69. or remove it to start afresh. See the list
  70. of <em><a href="variables.html">implemented GRASS variables</a></em>
  71. for more information. The rest of this help page will only consider
  72. shell environment variables.
  73. <p>Note that you will need to set these variables using the
  74. appropriate method required for the UNIX shell that you use (e.g. in a
  75. Bash shell you must <tt>export</tt> the variables for them to
  76. propogate).
  77. <h3>User Interface Environment Variable</h3>
  78. <p>The <em>grass70</em> program will check for the existence of an
  79. environment variable called GRASS_GUI which indicates the type of user
  80. interface for GRASS to use. If this variable is not set
  81. when <em>grass70</em> is run, then it will be created and then saved
  82. in the <tt>$HOME/.grass7/rc</tt> file for the next time GRASS is
  83. run. It can be set to <tt>text</tt>, <tt>gtext</tt> or <tt>gui</tt>.
  84. <p>There is an order of precedence in the way <em>grass70</em>
  85. determines the user interface to use. The following is the hierarchy
  86. from highest precedence to lowest.
  87. <ol>
  88. <li>Command line argument
  89. <li>Environment variable GRASS_GUI
  90. <li>Value set in <tt>$HOME/.grass7/rc</tt> (GUI)
  91. <li>Default value - <tt>gui</tt>
  92. </ol>
  93. <h3>Python Environment Variables</h3>
  94. <p>If you choose to use <em><a href="wxGUI.html">wxGUI</a></em>
  95. interface, then the GRASS_PYTHON environment variable can be used to
  96. override your system default <tt>python</tt> command.
  97. <p>Suppose for example your system has Python 2.4 installed and you
  98. install a personal version of the Python 2.5 binaries
  99. under <tt>$HOME/bin</tt>. You can use the above variables to have
  100. GRASS use the Python 2.5 binaries instead.
  101. <div class="code"><pre>
  102. GRASS_PYTHON=python2.5
  103. </pre></div>
  104. <h3>Addon Path to Extra User Scripts</h3>
  105. This environment variable allows the user to extend the GRASS program
  106. search paths to include locally developed/installed GRASS modules or
  107. user scripts.
  108. <div class="code"><pre>
  109. GRASS_ADDON_PATH=/usr/mytools
  110. GRASS_ADDON_PATH=/usr/mytools:/usr/local/othertools
  111. </pre></div>
  112. <p>In this example above path(s) would be added to the standard GRASS path
  113. environment.
  114. <h3>Addon Base for Extra Local GRASS Addon Modules</h3>
  115. This environment variable allows the user to extend the GRASS program
  116. search paths to include locally installed
  117. (see <em><a href="g.extension.html">g.extension</a></em> for details)
  118. <a href="http://grasswiki.osgeo.org/wiki/GRASS_AddOns">GRASS Addon</a>
  119. modules which are not distributed with the standard GRASS release.
  120. <div class="code"><pre>
  121. GRASS_ADDON_BASE=/usr/grass-addons
  122. </pre></div>
  123. <p>In this example above path would be added to the standard GRASS
  124. path environment.
  125. <p>If not defined by user, this variable is set by GRASS startup program
  126. to <tt>$HOME/.grass7/addons</tt> on GNU/Linux
  127. and <tt>$APPDATA\GRASS7\addons</tt> on MS Windows.
  128. <h3>HTML Browser Variable</h3>
  129. The GRASS_HTML_BROWSER environment variable allows the user to set the
  130. HTML web browser to use for displaying help pages.
  131. <h3>Location Environment Variables</h3>
  132. <p>The <b>Synopsis</b> section above describes options that can be used
  133. to set the location and mapset that GRASS will use. These values can
  134. also be set with environment variables. However, specifying the
  135. location and mapset variables on the command line will override these
  136. environment variables. The available variables are as follows:
  137. <dl>
  138. <dt>LOCATION
  139. <dd> A fully qualified path to a mapset
  140. (eg <tt>/usr/local/share/grassdata/spearfish60/PERMANENT</tt>). This
  141. environment variable overrides the GISDBASE, LOCATION_NAME, and
  142. MAPSET variables.
  143. <dt>GISDBASE
  144. <dd> Initial database directory which should be a fully qualified path
  145. (eg <tt>/usr/local/share/grassdata</tt>)
  146. <dt>LOCATION_NAME
  147. <dd> Initial location directory which is a subdirectory of GISDBASE
  148. <dt>MAPSET
  149. <dd> Initial mapset directory which is a subdirectory of LOCATION_NAME
  150. </dl>
  151. <h3>Running non-interactive batch jobs</h3>
  152. If the GRASS_BATCH_JOB environment variable is set to the <i>full</i>
  153. path and filename of a shell script then GRASS will be launched in a
  154. non-interactive way and the script will be run. The script itself can
  155. be interactive if that is what the user requires. When it is finished
  156. GRASS will automatically exit using the exit-success code given by the
  157. script. The script file must have its executable bit set.
  158. <h2>EXAMPLES</h2>
  159. <p>The following are some examples of how you could start GRASS
  160. <dl>
  161. <dt><b>grass70</b>
  162. <dd> Start GRASS using the default user interface. The user will be
  163. prompted to choose the appropriate location and mapset.
  164. <dt><b>grass70 -gui</b>
  165. <dd> Start GRASS using the graphical user interface. The user will be
  166. prompted to choose the appropriate location and mapset.
  167. <dt><b>grass70 -text</b>
  168. <dd> Start GRASS using the text-based user interface. Appropriate
  169. location and mapset must be set by environmental variables (see
  170. examples bellow) otherwise taken from the last GRASS session.</dd>
  171. <dt><b>grass70 -gtext</b>
  172. <dd> Start GRASS using the text-based user interface. The user will be
  173. prompted to choose the appropriate location and mapset.
  174. <dt><b>grass70 $HOME/grassdata/spearfish60/user1</b>
  175. <dd> Start GRASS using the default user interface and automatically
  176. launch into the given mapset, bypassing the mapset selection menu.
  177. <dt><b>grass70 -gui -</b>
  178. <dd> Start GRASS using the graphical user interface and try to
  179. obtain the location and mapset from environment variables.
  180. <dt><b>grass70 -c EPSG:4326 $HOME/grassdata/mylocation</b>
  181. <dd> Creates new GRASS location with EPSG code 4326 (latitude-longitude, WGS84)
  182. in the specified GISDBASE
  183. <dt><b>grass70 -c myvector.shp $HOME/grassdata/mylocation</b>
  184. <dd> Creates new GRASS location based on georeferenced Shapefile
  185. <dt><b>grass70 -c myraster.tif $HOME/grassdata/mylocation</b>
  186. <dd> Creates new GRASS location based on georeferenced GeoTIFF file
  187. </dl>
  188. <h3>Other examples</h3>
  189. There are a variety of ways in which the <i>location environment
  190. variables</i> (see above) can be used to specify the mapset to use.
  191. The following are some possible examples.
  192. <h4>Example 1</h4>
  193. The environment variables are defined as follows:
  194. <div class="code"><pre>
  195. LOCATION = /usr/local/share/grassdata/spearfish60/PERMANENT
  196. GISDBASE = /usr/local/share/grassdata
  197. LOCATION_NAME = spearfish60
  198. MAPSET = PERMANENT
  199. </pre></div>
  200. Start GRASS with the following command:
  201. <div class="code"><pre>
  202. grass70 -
  203. </pre></div>
  204. GRASS will start with the mapset defined by LOCATION since the LOCATION
  205. variable overrides the other variables.
  206. <h4>Example 2</h4>
  207. The environment variables are defined as follows:
  208. <div class="code"><pre>
  209. GISDBASE = /usr/local/share/grassdata
  210. LOCATION_NAME = spearfish60
  211. MAPSET = PERMANENT
  212. </pre></div>
  213. Start GRASS with the following command:
  214. <div class="code"><pre>
  215. grass70 -
  216. </pre></div>
  217. GRASS will start with the mapset defined by
  218. GISDBASE/LOCATION_NAME/MAPSET.
  219. <div class="code"><pre>
  220. grass70 /usr/home/grass/data/thailand/forests
  221. </pre></div>
  222. GRASS will start with the
  223. mapset <tt>/home/grass/data/thailand/forests</tt> which overrides the
  224. environment variables.
  225. <div class="code"><pre>
  226. grass70 swamps
  227. </pre></div>
  228. GRASS will start with the mapset defined by
  229. GISDBASE/LOCATION_NAME/swamps since the command line argument for the
  230. mapset overrides the environment variable MAPSET.
  231. <div class="code"><pre>
  232. grass70 thailand/forests
  233. </pre></div>
  234. GRASS will start with the mapset defined by GISDBASE/thailand/forests
  235. since the command line arguments for the location and mapset overrides
  236. the environment variables LOCATION_NAME and MAPSET.
  237. <h2>CAVEAT</h2>
  238. If you start GRASS using the <em><a href="wxGUI.html">wxGUI</a></em>
  239. interface you must have a <tt>python</tt> command in your $PATH
  240. variable. That is, the command must be named
  241. <tt>python</tt> and not something like <tt>python2.5</tt>. Rarely some
  242. Python installations do not create a <tt>python</tt> command. In these
  243. cases you can override <tt>python</tt> by GRASS_PYTHON environmental
  244. variable.
  245. <p>Furthermore, if you have more than one version of Python installed,
  246. make sure that the version you want to use with GRASS is set by
  247. GRASS_PYTHON environmental variable.
  248. <h2>SEE ALSO</h2>
  249. List of <a href="variables.html">GRASS environment variables</a>
  250. <p>
  251. <a href="http://grass.osgeo.org">GRASS GIS Web site</a><br>
  252. <a href="http://grass.osgeo.org/wiki">GRASS GIS User Wiki</a><br>
  253. <a href="http://trac.osgeo.org/grass">GRASS GIS Bug Tracker</a><br>
  254. <a href="http://grass.osgeo.org/programming7">GRASS GIS 7 Programmer's
  255. Manual</a>
  256. <h2>AUTHORS (of this page)</h2>
  257. Justin Hickey<br>
  258. Markus Neteler<br>
  259. Hamish Bowman<br>
  260. Martin Landa, Czech Technical University in Prague, Czech Republic
  261. <p>
  262. <i>Last changed: $Date$</i>