<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://grasswiki.osgeo.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=%E2%9A%A0%EF%B8%8FJgoizueta</id>
	<title>GRASS-Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://grasswiki.osgeo.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=%E2%9A%A0%EF%B8%8FJgoizueta"/>
	<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/wiki/Special:Contributions/%E2%9A%A0%EF%B8%8FJgoizueta"/>
	<updated>2026-05-26T05:27:24Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=User:Jgoizueta&amp;diff=23855</id>
		<title>User:Jgoizueta</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=User:Jgoizueta&amp;diff=23855"/>
		<updated>2017-01-11T13:49:36Z</updated>

		<summary type="html">&lt;p&gt;⚠️Jgoizueta: Add email&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I've worked in the past writing GIS-related C++ software and using SmallWorld, ArcGIS, etc.&lt;br /&gt;
&lt;br /&gt;
More recently I've been developing Ruby on Rails applications which integrate GIS technology such as PostGIS, MapLayers, MapServer, etc.&lt;br /&gt;
&lt;br /&gt;
As of 2015 I'm using Ruby to automate GRASS processes for a landscape modelling project, and planning to convert it into web services.&lt;br /&gt;
&lt;br /&gt;
Contact: jgoizueta (at) gmail.com&lt;/div&gt;</summary>
		<author><name>⚠️Jgoizueta</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=GRASS_and_Ruby&amp;diff=21716</id>
		<title>GRASS and Ruby</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=GRASS_and_Ruby&amp;diff=21716"/>
		<updated>2015-07-26T19:41:35Z</updated>

		<summary type="html">&lt;p&gt;⚠️Jgoizueta: Add links to the documentation and code sites&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Ruby language can be easily used to write scripts that execute GRASS commands with this gem:&lt;br /&gt;
&lt;br /&gt;
* https://github.com/jgoizueta/grassgis&lt;br /&gt;
&lt;br /&gt;
==Writing a Ruby script that uses GRASS==&lt;br /&gt;
&lt;br /&gt;
Let's see how to write a Ruby program that executes GRASS commands. You won't need to start GRASS explicitly,&lt;br /&gt;
the script will handle sessions internally as you will see.&lt;br /&gt;
&lt;br /&gt;
First, you need to install the gem in your system:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
gem install grassgis&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're using [http://bundler.io/ Bundler] you just need to add this to your &amp;lt;cod&amp;gt;Gemfile&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
gem 'grassgis'&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And then execute:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
bundle&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, in your Ruby source, you need to require the gem:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
require 'grassgis'&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To be able to use GRAS you need to open a GRASS session from your program; in&lt;br /&gt;
order to do so you'll need to provide some configuration parameters.&lt;br /&gt;
&lt;br /&gt;
=== Session Configuration ===&lt;br /&gt;
&lt;br /&gt;
Before starting a GRASS session we need some configuration&lt;br /&gt;
parameters to specify the path of the GRASS Installation&lt;br /&gt;
to be used and the location/mapset to be used. We do this by using&lt;br /&gt;
a Ruby Hash containing configuration parameters:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
configuration = {&lt;br /&gt;
  gisbase: '/usr/local/grass-7.0.0',&lt;br /&gt;
  gisdbase: File.join(ENV['HOME'], 'grassdata'),&lt;br /&gt;
  location: 'nc_spm',&lt;br /&gt;
  mapset: 'user1'&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So, you first need to know where is GRASS installed on your system&lt;br /&gt;
to define the &amp;lt;code&amp;gt;:gisbase&amp;lt;/code&amp;gt; option to point to the base directory of the GRASS&lt;br /&gt;
installation.&lt;br /&gt;
&lt;br /&gt;
In '''Windows''', if installed with&lt;br /&gt;
[http://trac.osgeo.org/osgeo4w/ OSGeo4W] it is typically of&lt;br /&gt;
the form &amp;lt;code&amp;gt;C:\OGeo4W\app\grass\grass-7.0.0&amp;lt;/code&amp;gt; (the last directory will vary&lt;br /&gt;
depending on the GRASS version).&lt;br /&gt;
&lt;br /&gt;
Under '''Mac OS X''', if using [http://brew.sh/ Homebrew]&lt;br /&gt;
(with the [https://github.com/OSGeo/homebrew-osgeo4mac osgeo/osgeo4mac] tap)&lt;br /&gt;
it should be something like &amp;lt;code&amp;gt;/usr/local/Cellar/grass-70/7.0.0/grass-7.0.0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In general, you can find the &amp;lt;code&amp;gt;:gisbase&amp;lt;/code&amp;gt; directory by executing the&lt;br /&gt;
&amp;lt;code&amp;gt;grass&amp;lt;/code&amp;gt; command of your system (which might be &amp;lt;code&amp;gt;grass70&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;grass64&amp;lt;/code&amp;gt;, etc.)&lt;br /&gt;
with the &amp;lt;code&amp;gt;--config path&amp;lt;/code&amp;gt; option:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
grass --config path&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must also specify the &amp;lt;code&amp;gt;GISDBASE&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;LOCATION&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;MAPSET&amp;lt;/code&amp;gt;, to work with,&lt;br /&gt;
just like when starting GRASS, through the &amp;lt;code&amp;gt;:gisdbase&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;:location&amp;lt;/code&amp;gt; and&lt;br /&gt;
&amp;lt;code&amp;gt;:mapset&amp;lt;/code&amp;gt; configuration options.&lt;br /&gt;
&lt;br /&gt;
You can omit &amp;lt;code&amp;gt;:gisdbase&amp;lt;/code&amp;gt; which will default to a directory named &amp;lt;code&amp;gt;grassdata&amp;gt;/code&amp;gt; in the&lt;br /&gt;
user's home directory and &amp;lt;code&amp;gt;:mapset/code&amp;gt; which defaults to &amp;lt;code&amp;gt;PERMANENT&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Running a GRASS Session ===&lt;br /&gt;
&lt;br /&gt;
With the proper configuration in place, we're ready to use it to&lt;br /&gt;
create a GRASS Session and execute GRASS command from it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
GrassGis.session configuration do&lt;br /&gt;
  g.list 'vect'&lt;br /&gt;
  puts output # will print list of vector maps&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the example we execute a GRASS command (&amp;lt;code&amp;gt;g.list 'vect'&amp;lt;/code&amp;gt;) then print its output to the console.&lt;br /&gt;
&lt;br /&gt;
Inside a &amp;lt;code&amp;gt;GrassGis&amp;lt;/code&amp;gt; session we can execute GRASS commands&lt;br /&gt;
just by using the command name as a Ruby method.&lt;br /&gt;
&lt;br /&gt;
Command flags and options must be passed first as regular method arguments,&lt;br /&gt;
then named parameters must be passed as a Ruby Hash:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
g.region '-p', rast: 'elevation'&lt;br /&gt;
d.rast 'elevation'&lt;br /&gt;
d.vect 'streams', col: 'blue'&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you try to execute an invalid module name an `ENOENT`&lt;br /&gt;
error will be raised:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
g.this.module.does.not.exist '???'&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the command to be executed has no arguments you need&lt;br /&gt;
to invoke `.run` on it to execute it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
d.erase.run&lt;br /&gt;
g.list.run&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== More Information ==&lt;br /&gt;
&lt;br /&gt;
* Read the docs at http://www.rubydoc.info/github/jgoizueta/grassgis&lt;br /&gt;
* Get the code from https://github.com/jgoizueta/grassgis&lt;br /&gt;
&lt;br /&gt;
[[Category:Linking to other languages]]&lt;/div&gt;</summary>
		<author><name>⚠️Jgoizueta</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=GRASS_and_Ruby&amp;diff=21714</id>
		<title>GRASS and Ruby</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=GRASS_and_Ruby&amp;diff=21714"/>
		<updated>2015-07-25T13:52:18Z</updated>

		<summary type="html">&lt;p&gt;⚠️Jgoizueta: Fix typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Ruby language can be easily used to write scripts that execute GRASS commands with this gem:&lt;br /&gt;
&lt;br /&gt;
* https://github.com/jgoizueta/grassgis&lt;br /&gt;
&lt;br /&gt;
==Writing a Ruby script that uses GRASS==&lt;br /&gt;
&lt;br /&gt;
Let's see how to write a Ruby program that executes GRASS commands. You won't need to start GRASS explicitly,&lt;br /&gt;
the script will handle sessions internally as you will see.&lt;br /&gt;
&lt;br /&gt;
First, you need to install the gem in your system:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
gem install grassgis&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're using [http://bundler.io/ Bundler] you just need to add this to your &amp;lt;cod&amp;gt;Gemfile&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
gem 'grassgis'&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And then execute:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
bundle&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, in your Ruby source, you need to require the gem:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
require 'grassgis'&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To be able to use GRAS you need to open a GRASS session from your program; in&lt;br /&gt;
order to do so you'll need to provide some configuration parameters.&lt;br /&gt;
&lt;br /&gt;
=== Session Configuration ===&lt;br /&gt;
&lt;br /&gt;
Before starting a GRASS session we need some configuration&lt;br /&gt;
parameters to specify the path of the GRASS Installation&lt;br /&gt;
to be used and the location/mapset to be used. We do this by using&lt;br /&gt;
a Ruby Hash containing configuration parameters:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
configuration = {&lt;br /&gt;
  gisbase: '/usr/local/grass-7.0.0',&lt;br /&gt;
  gisdbase: File.join(ENV['HOME'], 'grassdata'),&lt;br /&gt;
  location: 'nc_spm',&lt;br /&gt;
  mapset: 'user1'&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So, you first need to know where is GRASS installed on your system&lt;br /&gt;
to define the &amp;lt;code&amp;gt;:gisbase&amp;lt;/code&amp;gt; option to point to the base directory of the GRASS&lt;br /&gt;
installation.&lt;br /&gt;
&lt;br /&gt;
In '''Windows''', if installed with&lt;br /&gt;
[http://trac.osgeo.org/osgeo4w/ OSGeo4W] it is typically of&lt;br /&gt;
the form &amp;lt;code&amp;gt;C:\OGeo4W\app\grass\grass-7.0.0&amp;lt;/code&amp;gt; (the last directory will vary&lt;br /&gt;
depending on the GRASS version).&lt;br /&gt;
&lt;br /&gt;
Under '''Mac OS X''', if using [http://brew.sh/ Homebrew]&lt;br /&gt;
(with the [https://github.com/OSGeo/homebrew-osgeo4mac osgeo/osgeo4mac] tap)&lt;br /&gt;
it should be something like &amp;lt;code&amp;gt;/usr/local/Cellar/grass-70/7.0.0/grass-7.0.0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In general, you can find the &amp;lt;code&amp;gt;:gisbase&amp;lt;/code&amp;gt; directory by executing the&lt;br /&gt;
&amp;lt;code&amp;gt;grass&amp;lt;/code&amp;gt; command of your system (which might be &amp;lt;code&amp;gt;grass70&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;grass64&amp;lt;/code&amp;gt;, etc.)&lt;br /&gt;
with the &amp;lt;code&amp;gt;--config path&amp;lt;/code&amp;gt; option:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
grass --config path&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must also specify the &amp;lt;code&amp;gt;GISDBASE&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;LOCATION&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;MAPSET&amp;lt;/code&amp;gt;, to work with,&lt;br /&gt;
just like when starting GRASS, through the &amp;lt;code&amp;gt;:gisdbase&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;:location&amp;lt;/code&amp;gt; and&lt;br /&gt;
&amp;lt;code&amp;gt;:mapset&amp;lt;/code&amp;gt; configuration options.&lt;br /&gt;
&lt;br /&gt;
You can omit &amp;lt;code&amp;gt;:gisdbase&amp;lt;/code&amp;gt; which will default to a directory named &amp;lt;code&amp;gt;grassdata&amp;gt;/code&amp;gt; in the&lt;br /&gt;
user's home directory and &amp;lt;code&amp;gt;:mapset/code&amp;gt; which defaults to &amp;lt;code&amp;gt;PERMANENT&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Running a GRASS Session ===&lt;br /&gt;
&lt;br /&gt;
With the proper configuration in place, we're ready to use it to&lt;br /&gt;
create a GRASS Session and execute GRASS command from it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
GrassGis.session configuration do&lt;br /&gt;
  g.list 'vect'&lt;br /&gt;
  puts output # will print list of vector maps&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the example we execute a GRASS command (&amp;lt;code&amp;gt;g.list 'vect'&amp;lt;/code&amp;gt;) then print its output to the console.&lt;br /&gt;
&lt;br /&gt;
Inside a &amp;lt;code&amp;gt;GrassGis&amp;lt;/code&amp;gt; session we can execute GRASS commands&lt;br /&gt;
just by using the command name as a Ruby method.&lt;br /&gt;
&lt;br /&gt;
Command flags and options must be passed first as regular method arguments,&lt;br /&gt;
then named parameters must be passed as a Ruby Hash:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
g.region '-p', rast: 'elevation'&lt;br /&gt;
d.rast 'elevation'&lt;br /&gt;
d.vect 'streams', col: 'blue'&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you try to execute an invalid module name an `ENOENT`&lt;br /&gt;
error will be raised:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
g.this.module.does.not.exist '???'&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the command to be executed has no arguments you need&lt;br /&gt;
to invoke `.run` on it to execute it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
d.erase.run&lt;br /&gt;
g.list.run&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Linking to other languages]]&lt;/div&gt;</summary>
		<author><name>⚠️Jgoizueta</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=GRASS_and_Ruby&amp;diff=21713</id>
		<title>GRASS and Ruby</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=GRASS_and_Ruby&amp;diff=21713"/>
		<updated>2015-07-25T13:50:42Z</updated>

		<summary type="html">&lt;p&gt;⚠️Jgoizueta: Add instructions on how to use the grassgis Ruby gem&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Ruby language can be easily used to write scripts that execute GRASS commands with this gem:&lt;br /&gt;
&lt;br /&gt;
* https://github.com/jgoizueta/grassgis&lt;br /&gt;
&lt;br /&gt;
==Writing a Ruby script that uses GRASS==&lt;br /&gt;
&lt;br /&gt;
Let's see how to write a Ruby program that executes GRASS commands. You won't need to start GRASS explicitly,&lt;br /&gt;
the script will handle sessions internally as you will see.&lt;br /&gt;
&lt;br /&gt;
First, you need to install the gem in your system:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
gem install grassgis&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're using [http://bundler.io/ Bundler] you just need to add this to your &amp;lt;cod&amp;gt;Gemfile&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
gem 'grass'gis'&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And then execute:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
bundle&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, in your Ruby source, you need to require the gem:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
require 'grassgis'&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To be able to use GRAS you need to open a GRASS session from your program; in&lt;br /&gt;
order to do so you'll need to provide some configuration parameters.&lt;br /&gt;
&lt;br /&gt;
=== Session Configuration ===&lt;br /&gt;
&lt;br /&gt;
Before starting a GRASS session we need some configuration&lt;br /&gt;
parameters to specify the path of the GRASS Installation&lt;br /&gt;
to be used and the location/mapset to be used. We do this by using&lt;br /&gt;
a Ruby Hash containing configuration parameters:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
configuration = {&lt;br /&gt;
  gisbase: '/usr/local/grass-7.0.0',&lt;br /&gt;
  gisdbase: File.join(ENV['HOME'], 'grassdata'),&lt;br /&gt;
  location: 'nc_spm',&lt;br /&gt;
  mapset: 'user1'&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So, you first need to know where is GRASS installed on your system&lt;br /&gt;
to define the &amp;lt;code&amp;gt;:gisbase&amp;lt;/code&amp;gt; option to point to the base directory of the GRASS&lt;br /&gt;
installation.&lt;br /&gt;
&lt;br /&gt;
In '''Windows''', if installed with&lt;br /&gt;
[http://trac.osgeo.org/osgeo4w/ OSGeo4W] it is typically of&lt;br /&gt;
the form &amp;lt;code&amp;gt;C:\OGeo4W\app\grass\grass-7.0.0&amp;lt;/code&amp;gt; (the last directory will vary&lt;br /&gt;
depending on the GRASS version).&lt;br /&gt;
&lt;br /&gt;
Under '''Mac OS X''', if using [http://brew.sh/ Homebrew]&lt;br /&gt;
(with the [https://github.com/OSGeo/homebrew-osgeo4mac osgeo/osgeo4mac] tap)&lt;br /&gt;
it should be something like &amp;lt;code&amp;gt;/usr/local/Cellar/grass-70/7.0.0/grass-7.0.0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In general, you can find the &amp;lt;code&amp;gt;:gisbase&amp;lt;/code&amp;gt; directory by executing the&lt;br /&gt;
&amp;lt;code&amp;gt;grass&amp;lt;/code&amp;gt; command of your system (which might be &amp;lt;code&amp;gt;grass70&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;grass64&amp;lt;/code&amp;gt;, etc.)&lt;br /&gt;
with the &amp;lt;code&amp;gt;--config path&amp;lt;/code&amp;gt; option:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
grass --config path&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must also specify the &amp;lt;code&amp;gt;GISDBASE&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;LOCATION&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;MAPSET&amp;lt;/code&amp;gt;, to work with,&lt;br /&gt;
just like when starting GRASS, through the &amp;lt;code&amp;gt;:gisdbase&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;:location&amp;lt;/code&amp;gt; and&lt;br /&gt;
&amp;lt;code&amp;gt;:mapset&amp;lt;/code&amp;gt; configuration options.&lt;br /&gt;
&lt;br /&gt;
You can omit &amp;lt;code&amp;gt;:gisdbase&amp;lt;/code&amp;gt; which will default to a directory named &amp;lt;code&amp;gt;grassdata&amp;gt;/code&amp;gt; in the&lt;br /&gt;
user's home directory and &amp;lt;code&amp;gt;:mapset/code&amp;gt; which defaults to &amp;lt;code&amp;gt;PERMANENT&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Running a GRASS Session ===&lt;br /&gt;
&lt;br /&gt;
With the proper configuration in place, we're ready to use it to&lt;br /&gt;
create a GRASS Session and execute GRASS command from it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
GrassGis.session configuration do&lt;br /&gt;
  g.list 'vect'&lt;br /&gt;
  puts output # will print list of vector maps&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the example we execute a GRASS command (&amp;lt;code&amp;gt;g.list 'vect'&amp;lt;/code&amp;gt;) then print its output to the console.&lt;br /&gt;
&lt;br /&gt;
Inside a &amp;lt;code&amp;gt;GrassGis&amp;lt;/code&amp;gt; session we can execute GRASS commands&lt;br /&gt;
just by using the command name as a Ruby method.&lt;br /&gt;
&lt;br /&gt;
Command flags and options must be passed first as regular method arguments,&lt;br /&gt;
then named parameters must be passed as a Ruby Hash:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
g.region '-p', rast: 'elevation'&lt;br /&gt;
d.rast 'elevation'&lt;br /&gt;
d.vect 'streams', col: 'blue'&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you try to execute an invalid module name an `ENOENT`&lt;br /&gt;
error will be raised:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
g.this.module.does.not.exist '???'&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the command to be executed has no arguments you need&lt;br /&gt;
to invoke `.run` on it to execute it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
d.erase.run&lt;br /&gt;
g.list.run&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Linking to other languages]]&lt;/div&gt;</summary>
		<author><name>⚠️Jgoizueta</name></author>
	</entry>
</feed>