<?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%8FGeorgew</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%8FGeorgew"/>
	<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/wiki/Special:Contributions/%E2%9A%A0%EF%B8%8FGeorgew"/>
	<updated>2026-04-16T05:42:59Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=Using_Eclipse_to_develop_GRASS_Python_programs&amp;diff=8776</id>
		<title>Using Eclipse to develop GRASS Python programs</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=Using_Eclipse_to_develop_GRASS_Python_programs&amp;diff=8776"/>
		<updated>2009-05-11T09:28:22Z</updated>

		<summary type="html">&lt;p&gt;⚠️Georgew: /* Configuring Eclipse and Pydev */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;          &lt;br /&gt;
= How to use Eclipse to develop Python scripts that access GRASS object =&lt;br /&gt;
 &lt;br /&gt;
Recent releases of GRASS have emphasised the use of Python as the language of choice for developing scripts which access GRASS objects and can be used to automate operations without GRASS running.&lt;br /&gt;
 &lt;br /&gt;
This short tutorial shows how to set up a complete development environment using the Eclipse IDE to develop, debug and run Python programs that access GRASS objects. These instructions apply to both Windows and Linux and possibly Mac as well since all the packages required are open source software which runs on all three platforms.&lt;br /&gt;
&lt;br /&gt;
Please note that this is not an Eclipse, nor a Python, nor a GRASS tutorial. It is just a description on how to get all the above to work together. It assumes some (but not  much, because I don't have much!) knowledge of all the above.&lt;br /&gt;
	&lt;br /&gt;
=== Prerequisites (Release versions are as at the time of writing) ===&lt;br /&gt;
 &lt;br /&gt;
* GRASS 6.4 and Python 2.6.x&lt;br /&gt;
* Eclipse 3.4.x&lt;br /&gt;
* Pydev 1.4.5 Eclipse plug-in for Python&lt;br /&gt;
* Optionally, other plugins for Eclipse&lt;br /&gt;
 &lt;br /&gt;
==== GRASS 6.4.0RC4 and Python 2.6.x ====&lt;br /&gt;
&lt;br /&gt;
		Many Linux distributions already include GRASS in their packaging but you must ensure you download the latest (GRASS 6.4.0RC4) release  for Linux and Windows and MAC, available in binary (executable) from the GRASS [[download site]], and install it as instructed for your platform. You will also need to download Python 2.6 for your platform from the [[Python.org site]] and install it as required for your platform making a note of where the python executable (python.exe in Windows) is installed. Most recent Linux already come with Python 2.6.2 installed. &lt;br /&gt;
		&lt;br /&gt;
==== Eclipse ====&lt;br /&gt;
&lt;br /&gt;
		Eclipse 3.4.2 is the minimum version recommended, but other releases could work as well. Download it from [[the Eclipse download page]]. The Ganymede 3.4.2 release for Java developers is fine (85MB). Installing Eclipse is very easy because installations consists simply of unpacking the download package in a directory of your choice.&lt;br /&gt;
To avoid permission problems in Linux, install Eclipse in your Home directory or a subdirectory.&lt;br /&gt;
		&lt;br /&gt;
==== Pydev ====&lt;br /&gt;
Pydev is an Eclipse plugin that adapts the Eclipse platform to the specific needs of Python program  development, debugging and testing. It is not the only Python plugin available, but the one largely recommended.&lt;br /&gt;
The current release is 1.4.5 and to install it you should use the Eclipse Update Manager mechanism, as detailed below.&lt;br /&gt;
&lt;br /&gt;
Open the Eclipse platform and click on the Help -&amp;gt; Software Updates menu entry, click on the Available Software tab and click on the Add Site button. This will open a dialog box where you insert the following URL:  [[http://pydev.sourceforge.net/updates/]] then press OK and follow the instructions. This will result in the Pydev plug-in being automatically downloaded and installed among your other Eclipse plug-ins and furthermore it will automatically inform you in future when new updates are available. The Home page for Pydev is: [[here]]&lt;br /&gt;
At this point you have all the software pre-requisites installed, ready for the next step.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Creating a new project ====&lt;br /&gt;
When you first open the Eclipse platform after a new installation you will be asked to set-up a workspace, which will normally be in your home directory by default, then you will see  a Welcome screen with various buttons. Click on the one that opens the Eclipse workspace, which will be empty and probably be Java oriented.&lt;br /&gt;
To change it to be Python oriented you must open what in Eclipse is called a &amp;quot;perspective&amp;quot;, which is a combination of views and windows which suits the plug-in you are actually using at any one time. So, go to the Window -&amp;gt; Open Perspective sub-menu and select Pydev. This will open the Pydev perspective where most of your development work will be done, and since new development starts with a new Project, now go to the File -&amp;gt; New menu and select Pydev Project, and follow the prompts to create a new empty Python project which we will name Myproject. Finally create the following new Python source program by right-clicking the Myproject source tree and selecting New -&amp;gt; File from the menu. Name the file test.py (including the extension) and when the empty file opens on your workspace paste the following lines:&lt;br /&gt;
		&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;import os&lt;br /&gt;
import grass&lt;br /&gt;
env = grass.gisenv()&lt;br /&gt;
print env&lt;br /&gt;
#List all environment variables&lt;br /&gt;
for key, value in os.environ.items(): print key, value &lt;br /&gt;
#Print region extent&lt;br /&gt;
r = grass.read_command(&amp;quot;g.region&amp;quot;, flags='p' )&lt;br /&gt;
print r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Save the file but don't run it yet because you will only get a number of serious error messages! which brings us to the final step...&lt;br /&gt;
==== Configuring Eclipse and Pydev ====&lt;br /&gt;
Eclipse is highly configurable, but for our purpose we will only look at the configuration required for Python use. &lt;br /&gt;
There are three preferences menus you should know,  the Window (or Eclipse) Preferences menu, the Project Properties menu, and the Run or Debug Configuration menu, but for our needs we will just look at Window and Run Configuration.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Open the Window -&amp;gt; Preferences menu, expand the Pydev entry and select Interpreter - Python. Sometime Eclipse can automatically detect the location of your Python interpreter, in which case it will appear in the top right box: but if it didn't simply add it via the New button (remember you made a note of its location earlier on!).&lt;br /&gt;
In the bottom box add the following New Folders to the ones automatically added by Eclipse, and which point to the GRASS libraries (in Windows/Mac(?) they will be located within the GRASS installation directory tree):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/usr/lib/grass64/etc&lt;br /&gt;
/usr/lib/grass64/etc/python&lt;br /&gt;
/usr/lib/grass64/scripts&lt;br /&gt;
/usr/lib/grass64/bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
then press Apply and OK. Finally go to the Run  Configurations menu and create a new entry for test.py as follows:&lt;br /&gt;
* Click on Python Run, then click on the New configuration icon, the first at the top. Provide a Name, Project and Module names either manually or by browsing and press Apply to create the new configuration.&lt;br /&gt;
* Click on the Environment tab and enter the following variables and values, keeping in mind that as shown they reflect my configuration.When you start GRASS it sets most of these variables but since you now want to run programs without GRASS itself running, you will have to set them yourself and find the equivalent locations for your specific configuration. If you have trouble do the following: in Windows or Linux (and Mac?) start GRASS  and in the GRASS command shell type 'export' without quotes or parameters. This will list all the variables and their values as they apply to your GRASS environment, but don't be scared by their number, just look up the few I have listed then adjust their values  accordingly: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GISBASE = /usr/lib/grass64&lt;br /&gt;
GISRC = /home/george/.grassrc6 		&lt;br /&gt;
LD_LIBRARY_PATH = /usr/lib/grass64/lib 		&lt;br /&gt;
PATH = .:/home/george/local/jdk1.6.0_13/lib:/home/george/local/jdk1.6.0_13/jre:/home/george/local/jdk1.6.0_13/jre/bin/java:&lt;br /&gt;
/home/george/local/jdk1.6.0_13/jre/bin:/usr/lib/grass64:/usr/lib/grass64/bin:/usr/lib/python2.6:/usr/lib/grass64/lib:usr/&lt;br /&gt;
lib/grass64//scripts:/usr/lib/grass64/etc:/usr/lib/grass64/etc/python:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games 		&lt;br /&gt;
PYTHONPATH = .:/usr/lib/grass64/etc:/usr/lib/grass64/etc/python:/usr/lib/grass64/lib:/usr/lib/grass64/bin:/usr/lib/grass64/scripts:/usr/lib/python2.6&lt;br /&gt;
PYTHONLIB = /usr/lib/python2.6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and Apply all of them.&lt;br /&gt;
* Now click on the Interpreter tab to verify that the interpreter has been correctly located and Pyhonpath correctly set.&lt;br /&gt;
&lt;br /&gt;
Press OK to exit and now you are ready to run or debug your first Python program from Eclipse! Press the Run button in the Run Configuration dialog, or from the Run menu select 'Run'.&lt;br /&gt;
[[Category:FAQ]]&lt;/div&gt;</summary>
		<author><name>⚠️Georgew</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=Using_Eclipse_to_develop_GRASS_Python_programs&amp;diff=8773</id>
		<title>Using Eclipse to develop GRASS Python programs</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=Using_Eclipse_to_develop_GRASS_Python_programs&amp;diff=8773"/>
		<updated>2009-05-11T04:02:33Z</updated>

		<summary type="html">&lt;p&gt;⚠️Georgew: Using Eclipse to develop Python programs that access GRASS objects&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;          &lt;br /&gt;
= How to use Eclipse to develop Python scripts that access GRASS object =&lt;br /&gt;
 &lt;br /&gt;
Recent releases of GRASS have emphasised the use of Python as the language of choice for developing scripts which access GRASS objects and can be used to automate operations without GRASS running.&lt;br /&gt;
 &lt;br /&gt;
This short tutorial shows how to set up a complete development environment using the Eclipse IDE to develop, debug and run Python programs that access GRASS objects. These instructions apply to both Windows and Linux and possibly Mac as well since all the packages required are open source software which runs on all three platforms.&lt;br /&gt;
&lt;br /&gt;
Please note that this is not an Eclipse, nor a Python, nor a GRASS tutorial. It is just a description on how to get all the above to work together. It assumes some (but not  much, because I don't have much!) knowledge of all the above.&lt;br /&gt;
	&lt;br /&gt;
=== Prerequisites (Release versions are as at the time of writing) ===&lt;br /&gt;
 &lt;br /&gt;
* GRASS 6.4 and Python 2.6.x&lt;br /&gt;
* Eclipse 3.4.x&lt;br /&gt;
* Pydev 1.4.5 Eclipse plug-in for Python&lt;br /&gt;
* Optionally, other plugins for Eclipse&lt;br /&gt;
 &lt;br /&gt;
==== GRASS 6.4.0RC4 and Python 2.6.x ====&lt;br /&gt;
&lt;br /&gt;
		Many Linux distributions already include GRASS in their packaging but you must ensure you download the latest (GRASS 6.4.0RC4) release  for Linux and Windows and MAC, available in binary (executable) from the GRASS [[download site]], and install it as instructed for your platform. You will also need to download Python 2.6 for your platform from the [[Python.org site]] and install it as required for your platform making a note of where the python executable (python.exe in Windows) is installed. Most recent Linux already come with Python 2.6.2 installed. &lt;br /&gt;
		&lt;br /&gt;
==== Eclipse ====&lt;br /&gt;
&lt;br /&gt;
		Eclipse 3.4.2 is the minimum version recommended, but other releases could work as well. Download it from [[the Eclipse download page]]. The Ganymede 3.4.2 release for Java developers is fine (85MB). Installing Eclipse is very easy because installations consists simply of unpacking the download package in a directory of your choice.&lt;br /&gt;
To avoid permission problems in Linux, install Eclipse in your Home directory or a subdirectory.&lt;br /&gt;
		&lt;br /&gt;
==== Pydev ====&lt;br /&gt;
Pydev is an Eclipse plugin that adapts the Eclipse platform to the specific needs of Python program  development, debugging and testing. It is not the only Python plugin available, but the one largely recommended.&lt;br /&gt;
The current release is 1.4.5 and to install it you should use the Eclipse Update Manager mechanism, as detailed below.&lt;br /&gt;
&lt;br /&gt;
Open the Eclipse platform and click on the Help -&amp;gt; Software Updates menu entry, click on the Available Software tab and click on the Add Site button. This will open a dialog box where you insert the following URL:  [[http://pydev.sourceforge.net/updates/]] then press OK and follow the instructions. This will result in the Pydev plug-in being automatically downloaded and installed among your other Eclipse plug-ins and furthermore it will automatically inform you in future when new updates are available. The Home page for Pydev is: [[here]]&lt;br /&gt;
At this point you have all the software pre-requisites installed, ready for the next step.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Creating a new project ====&lt;br /&gt;
When you first open the Eclipse platform after a new installation you will be asked to set-up a workspace, which will normally be in your home directory by default, then you will see  a Welcome screen with various buttons. Click on the one that opens the Eclipse workspace, which will be empty and probably be Java oriented.&lt;br /&gt;
To change it to be Python oriented you must open what in Eclipse is called a &amp;quot;perspective&amp;quot;, which is a combination of views and windows which suits the plug-in you are actually using at any one time. So, go to the Window -&amp;gt; Open Perspective sub-menu and select Pydev. This will open the Pydev perspective where most of your development work will be done, and since new development starts with a new Project, now go to the File -&amp;gt; New menu and select Pydev Project, and follow the prompts to create a new empty Python project which we will name Myproject. Finally create the following new Python source program by right-clicking the Myproject source tree and selecting New -&amp;gt; File from the menu. Name the file test.py (including the extension) and when the empty file opens on your workspace paste the following lines:&lt;br /&gt;
		&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;import os&lt;br /&gt;
import grass&lt;br /&gt;
env = grass.gisenv()&lt;br /&gt;
print env&lt;br /&gt;
#List all environment variables&lt;br /&gt;
for key, value in os.environ.items(): print key, value &lt;br /&gt;
#Print region extent&lt;br /&gt;
r = grass.read_command(&amp;quot;g.region&amp;quot;, flags='p' )&lt;br /&gt;
print r&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Save the file but don't run it yet because you will only get a number of serious error messages! which brings us to the final step...&lt;br /&gt;
==== Configuring Eclipse and Pydev ====&lt;br /&gt;
Eclipse is highly configurable, but for our purpose we will only look at the configuration required for Python use. &lt;br /&gt;
There are three preferences menus you should know,  the Window (or Eclipse) Preferences menu, the Project Properties menu, and the Run or Debug Configuration menu, but for our needs we will just look at Window and Run Configuration.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Open the Window -&amp;gt; Preferences menu, expand the Pydev entry and select Interpreter - Python. Sometime Eclipse can automatically detect the location of your Python interpreter, in which case it will appear in the top right box: but if it didn't simply add it via the New button (remember you made a note of its location earlier on!).&lt;br /&gt;
In the bottom box add the following New Folders to the ones automatically added by Eclipse, and which point to the GRASS libraries (in Windows/Mac(?) they will be located within the GRASS installation directory tree):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/usr/lib/grass64/etc&lt;br /&gt;
/usr/lib/grass64/etc/python&lt;br /&gt;
/usr/lib/grass64/scripts&lt;br /&gt;
/usr/lib/grass64/bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
then press Apply and OK. Finally go to the Run  Configurations menu and create a new entry for test.py as follows:&lt;br /&gt;
* Click on Python Run, then click on the New configuration icon, the first at the top. Provide a Name, Project and Module names either manually or by browsing and press Apply to create the new configuration.&lt;br /&gt;
* Click on the Environment tab and enter the following variables and values, keeping in mind that as shown they reflect my configuration.When you start GRASS it sets most of these variables but since you now want to run programs without GRASS itself running, you will have to set them yourself and find the equivalent locations for your specific configuration. If you have trouble do the following: in Windows or Linux (and Mac?) start GRASS  and in the GRASS command shell type 'export' without quotes or parameters. This will list all the variables and their values as they apply to your GRASS environment, but don't be scared by their number, just look up the few I have listed then adjust their values  accordingly: &amp;lt;pre&amp;gt; 		GISBASE = /usr/lib/grass64 		GISRC = /home/george/.grassrc6 		LD_LIBRARY_PATH = /usr/lib/grass64/lib 		PATH = .:/home/george/local/jdk1.6.0_13/lib:/home/george/local/jdk1.6.0_13/jre:/home/george/local/jdk1.6.0_13/jre/bin/java:/home/george/local/jdk1.6.0_13/jre/bin:/usr/lib/grass64:/usr/lib/grass64/bin:/usr/lib/python2.6:/usr/lib/grass64/lib:usr/lib/grass64//scripts:/usr/lib/grass64/etc:/usr/lib/grass64/etc/python:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games 		PYTHONPATH = .:/usr/lib/grass64/etc:/usr/lib/grass64/etc/python:/usr/lib/grass64/lib:/usr/lib/grass64/bin:/usr/lib/grass64/scripts:/usr/lib/python2.6 		PYTHONLIB = /usr/lib/python2.6 		 &amp;lt;/pre&amp;gt; and Apply all of them.&lt;br /&gt;
* Now click on the Interpreter tab to verify that the interpreter has been correctly located and Pyhonpath correctly set.&lt;br /&gt;
&lt;br /&gt;
Press OK to exit and now you are ready to run or debug your first Python program from Eclipse! Press the Run button in the Run Configuration dialog, or from the Run menu select 'Run'.&lt;br /&gt;
[[Category:FAQ]]&lt;/div&gt;</summary>
		<author><name>⚠️Georgew</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=How_to_create_an_elevation_profile&amp;diff=7948</id>
		<title>How to create an elevation profile</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=How_to_create_an_elevation_profile&amp;diff=7948"/>
		<updated>2008-12-09T05:43:33Z</updated>

		<summary type="html">&lt;p&gt;⚠️Georgew: /*  1. Importing the shapefiles into GRASS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Q: === &lt;br /&gt;
How to create an elevation profile from intersecting shapefiles&lt;br /&gt;
&lt;br /&gt;
=== A: === &lt;br /&gt;
You want to create an elevation profile for a walking track described in one file, when the only available elevation data is contained in another file describing the terrain contours for the same region as the track.&lt;br /&gt;
It is assumed both files are available to GRASS in shapefile format.&lt;br /&gt;
In order to ascertain the elevation along the length of the track, you must calculate the elevation at the points where the track intersects with the contour lines, whose elevation is known.&lt;br /&gt;
GRASS can handle data in both vector and raster form. In this instance we will start with the two shapefiles in vector form, one representing the coordinates of the track, the other the coordinates and the elevation of the contour lines. We will then convert them to raster form in order to establish the elevation at the points where the track intersects the contours, and finally produce the track elevation profile data.&lt;br /&gt;
&lt;br /&gt;
==== ''' 1. Importing the shapefiles into GRASS''' ====&lt;br /&gt;
&lt;br /&gt;
 {{cmd|v.in.ogr}} -o dsn=/home/george/GRASSDATA/Contour.shp \&lt;br /&gt;
    output=contours_vect min_area=0.0001 type=line snap=-1&lt;br /&gt;
 &lt;br /&gt;
 v.in.ogr -o dsn=/home/george/GRASSDATA/Track_cl.shp \&lt;br /&gt;
    output=tracks_vect min_area=0.0001 type=line snap=-1&lt;br /&gt;
&lt;br /&gt;
At this point you can optionally visualize the map display using the GRASS Display Manager which opens up automatically when you start GRASS.&lt;br /&gt;
You can also check that the elevation values have been correctly imported using:&lt;br /&gt;
{{cmd|v.db.select}}&lt;br /&gt;
using elevation as the property to list.&lt;br /&gt;
&lt;br /&gt;
==== 2. '''Set the computational region resolution and convert vector to raster''' ====&lt;br /&gt;
&lt;br /&gt;
In order to convert the vector files to raster we will use the {{cmd|v.to.rast}} program.&lt;br /&gt;
However before you proceed you MUST ensure that the computational region is set to the correct resolution. The v.to.rast documentation has an innocent looking warning which reads as follows:&lt;br /&gt;
&lt;br /&gt;
''&amp;quot;v.to.rast will only affect data in areas lying inside the boundaries of the current geographic region. Before running v.to.rast, the user should therefore ensure that the current geographic region is correctly set and that the region resolution is at the desired level.&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
Do not ignore this warning as the most likely outcome will be a probably useless raster map consisting of large, chunky squares for each pixel.&lt;br /&gt;
To change the resolution of the computational region use the g.region command with an appropriate resolution. Some experimentation might be required. For example use:&lt;br /&gt;
&lt;br /&gt;
 g.region -s -p res=10&lt;br /&gt;
&lt;br /&gt;
which will create a resolution where every pixel on the map represents 10 metres on the ground. Then from the Map Display window icons bar click  the &amp;quot;zoom to...&amp;quot; icon (a magnifying glass over a small map) and from the drop menu select &amp;quot;Set computational region extents to match display&amp;quot;. That's it. You can now safely convert your vector files to raster, as follows:&lt;br /&gt;
&lt;br /&gt;
 v.to.rast input=contours_vect output=contours_rast use=attr \&lt;br /&gt;
    type=line layer=1 column=ELEVATION value=1 rows=4096 &lt;br /&gt;
 &lt;br /&gt;
 v.to.rast input=tracks_vect output=tracks_rast use=val \&lt;br /&gt;
    type=line layer=1 value=1 rows=4096&lt;br /&gt;
&lt;br /&gt;
==== 3. '''Creating the elevation profile''' ====&lt;br /&gt;
&lt;br /&gt;
 r.surf.contour input=contours_rast output=elevmap_raster&lt;br /&gt;
&lt;br /&gt;
Few seconds later it should have completed its job without errors. Then go ahead with:&lt;br /&gt;
&lt;br /&gt;
 r.profile -i input=elevmap_rast output=- null=*&lt;br /&gt;
&lt;br /&gt;
The -i options allows interactive following of the track on the display map by clicking with the left mouse button along the section of the track you are interested in, and a two column list of values will be printed on stdout, containing the distance between points and the elevation. Use any spreadsheet application to plot the values.&lt;br /&gt;
Alternatively, you can omit the -i option and pipe the list of coordinates to r.profile as follows:&lt;br /&gt;
&lt;br /&gt;
The *profile* parameter can be set to comma separated geographic&lt;br /&gt;
coordinates for profile line endpoints. (The interactive flag (*-i*) overrides this option). Alternatively the coordinate pairs can be piped&lt;br /&gt;
from stdin, one comma separated pair per line.&lt;br /&gt;
&lt;br /&gt;
You can get the coordinate pairs from your track vector with&lt;br /&gt;
''v.out.ascii'', and use the ''fs='', option to make the output file&lt;br /&gt;
&amp;quot;comma-separated&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
==== 4. '''An alternative''' has been suggested (not tested yet): ====&lt;br /&gt;
Use the command ''v.drape'' to get profiles on raster maps along lines from vector maps. The command to be executed is something like.&lt;br /&gt;
&lt;br /&gt;
 v.drape input=perfil out=perfil_n_mg type=point rast=eigen \&lt;br /&gt;
    method=cubic&lt;br /&gt;
&lt;br /&gt;
And to convert the profiles to ascii files, like tables, you can run:&lt;br /&gt;
&lt;br /&gt;
 v.out.ascii perfil_n_mg &amp;gt; perfil_n_mg.txt&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;/div&gt;</summary>
		<author><name>⚠️Georgew</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=How_to_create_an_elevation_profile&amp;diff=7947</id>
		<title>How to create an elevation profile</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=How_to_create_an_elevation_profile&amp;diff=7947"/>
		<updated>2008-12-07T07:28:12Z</updated>

		<summary type="html">&lt;p&gt;⚠️Georgew: /* A: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Q: === &lt;br /&gt;
How to create an elevation profile from intersecting shapefiles&lt;br /&gt;
&lt;br /&gt;
=== A: === &lt;br /&gt;
You want to create an elevation profile for a walking track described in one file, when the only available elevation data is contained in another file describing the terrain contours for the same region as the track.&lt;br /&gt;
It is assumed both files are available to GRASS in shapefile format.&lt;br /&gt;
In order to ascertain the elevation along the length of the track, you must calculate the elevation at the points where the track intersects with the contour lines, whose elevation is known.&lt;br /&gt;
GRASS can handle data in both vector and raster form. In this instance we will start with the two shapefiles in vector form, one representing the coordinates of the track, the other the coordinates and the elevation of the contour lines. We will then convert them to raster form in order to establish the elevation at the points where the track intersects the contours, and finally produce the track elevation profile data.&lt;br /&gt;
&lt;br /&gt;
==== ''' 1. Importing the shapefiles into GRASS''' ====&lt;br /&gt;
&lt;br /&gt;
 {{cmd|v.in.ogr}} -o dsn=/home/george/GRASSDATA/Contour.shp \&lt;br /&gt;
    output=contours_vect min_area=0.0001 type=line snap=-1&lt;br /&gt;
 &lt;br /&gt;
 v.in.ogr -o dsn=/home/george/GRASSDATA/Track_cl.shp \&lt;br /&gt;
    output=tracks_vect min_area=0.0001 type=line snap=-1&lt;br /&gt;
&lt;br /&gt;
At this point you can optionally visualize the map display using the GRASS Display Manager which opens up automatically when you start GRASS.&lt;br /&gt;
&lt;br /&gt;
==== 2. '''Set the computational region resolution and convert vector to raster''' ====&lt;br /&gt;
&lt;br /&gt;
In order to convert the vector files to raster we will use the {{cmd|v.to.rast}} program.&lt;br /&gt;
However before you proceed you MUST ensure that the computational region is set to the correct resolution. The v.to.rast documentation has an innocent looking warning which reads as follows:&lt;br /&gt;
&lt;br /&gt;
''&amp;quot;v.to.rast will only affect data in areas lying inside the boundaries of the current geographic region. Before running v.to.rast, the user should therefore ensure that the current geographic region is correctly set and that the region resolution is at the desired level.&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
Do not ignore this warning as the most likely outcome will be a probably useless raster map consisting of large, chunky squares for each pixel.&lt;br /&gt;
To change the resolution of the computational region use the g.region command with an appropriate resolution. Some experimentation might be required. For example use:&lt;br /&gt;
&lt;br /&gt;
 g.region -s -p res=10&lt;br /&gt;
&lt;br /&gt;
which will create a resolution where every pixel on the map represents 10 metres on the ground. Then from the Map Display window icons bar click  the &amp;quot;zoom to...&amp;quot; icon (a magnifying glass over a small map) and from the drop menu select &amp;quot;Set computational region extents to match display&amp;quot;. That's it. You can now safely convert your vector files to raster, as follows:&lt;br /&gt;
&lt;br /&gt;
 v.to.rast input=contours_vect output=contours_rast use=attr \&lt;br /&gt;
    type=line layer=1 column=ELEVATION value=1 rows=4096 &lt;br /&gt;
 &lt;br /&gt;
 v.to.rast input=tracks_vect output=tracks_rast use=val \&lt;br /&gt;
    type=line layer=1 value=1 rows=4096&lt;br /&gt;
&lt;br /&gt;
==== 3. '''Creating the elevation profile''' ====&lt;br /&gt;
&lt;br /&gt;
 r.surf.contour input=contours_rast output=elevmap_raster&lt;br /&gt;
&lt;br /&gt;
Few seconds later it should have completed its job without errors. Then go ahead with:&lt;br /&gt;
&lt;br /&gt;
 r.profile -i input=elevmap_rast output=- null=*&lt;br /&gt;
&lt;br /&gt;
The -i options allows interactive following of the track on the display map by clicking with the left mouse button along the section of the track you are interested in, and a two column list of values will be printed on stdout, containing the distance between points and the elevation. Use any spreadsheet application to plot the values.&lt;br /&gt;
Alternatively, you can omit the -i option and pipe the list of coordinates to r.profile as follows:&lt;br /&gt;
&lt;br /&gt;
The *profile* parameter can be set to comma separated geographic&lt;br /&gt;
coordinates for profile line endpoints. (The interactive flag (*-i*) overrides this option). Alternatively the coordinate pairs can be piped&lt;br /&gt;
from stdin, one comma separated pair per line.&lt;br /&gt;
&lt;br /&gt;
You can get the coordinate pairs from your track vector with&lt;br /&gt;
''v.out.ascii'', and use the ''fs='', option to make the output file&lt;br /&gt;
&amp;quot;comma-separated&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
==== 4. '''An alternative''' has been suggested (not tested yet): ====&lt;br /&gt;
Use the command ''v.drape'' to get profiles on raster maps along lines from vector maps. The command to be executed is something like.&lt;br /&gt;
&lt;br /&gt;
 v.drape input=perfil out=perfil_n_mg type=point rast=eigen \&lt;br /&gt;
    method=cubic&lt;br /&gt;
&lt;br /&gt;
And to convert the profiles to ascii files, like tables, you can run:&lt;br /&gt;
&lt;br /&gt;
 v.out.ascii perfil_n_mg &amp;gt; perfil_n_mg.txt&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;/div&gt;</summary>
		<author><name>⚠️Georgew</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=How_to_create_an_elevation_profile&amp;diff=7946</id>
		<title>How to create an elevation profile</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=How_to_create_an_elevation_profile&amp;diff=7946"/>
		<updated>2008-12-07T07:23:01Z</updated>

		<summary type="html">&lt;p&gt;⚠️Georgew: /* A: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Q: === &lt;br /&gt;
How to create an elevation profile from intersecting shapefiles&lt;br /&gt;
&lt;br /&gt;
=== A: === &lt;br /&gt;
You want to create an elevation profile for a walking track described in one file, when the only available elevation data is contained in another file describing the terrain contours for the same region as the track.&lt;br /&gt;
It is assumed both files are available to GRASS in shapefile format.&lt;br /&gt;
In order to ascertain the elevation along the length of the track, you must calculate the elevation at the points where the track intersects with the contour lines, whose elevation is known.&lt;br /&gt;
GRASS can handle data in both vector and raster form. In this instance we will start with the two shapefiles in vector form, one representing the coordinates of the track, the other the coordinates and the elevation of the contour lines. We will then convert them to raster form in order to establish the elevation at the points where the track intersects the contours, and finally produce the track elevation profile data.&lt;br /&gt;
&lt;br /&gt;
* ''' Importing the shapefiles into GRASS'''&lt;br /&gt;
&lt;br /&gt;
 {{cmd|v.in.ogr}} -o dsn=/home/george/GRASSDATA/Contour.shp \&lt;br /&gt;
    output=contours_vect min_area=0.0001 type=line snap=-1&lt;br /&gt;
 &lt;br /&gt;
 v.in.ogr -o dsn=/home/george/GRASSDATA/Track_cl.shp \&lt;br /&gt;
    output=tracks_vect min_area=0.0001 type=line snap=-1&lt;br /&gt;
&lt;br /&gt;
At this point you can optionally visualize the map display using the GRASS Display Manager which opens up automatically when you start GRASS.&lt;br /&gt;
&lt;br /&gt;
* '''Set the computational region resolution and convert vector to raster'''&lt;br /&gt;
&lt;br /&gt;
In order to convert the vector files to raster we will use the {{cmd|v.to.rast}} program.&lt;br /&gt;
However before you proceed you MUST ensure that the computational region is set to the correct resolution. The v.to.rast documentation has an innocent looking warning which reads as follows:&lt;br /&gt;
&lt;br /&gt;
''&amp;quot;v.to.rast will only affect data in areas lying inside the boundaries of the current geographic region. Before running v.to.rast, the user should therefore ensure that the current geographic region is correctly set and that the region resolution is at the desired level.&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
Do not ignore this warning as the most likely outcome will be a probably useless raster map consisting of large, chunky squares for each pixel.&lt;br /&gt;
To change the resolution of the computational region use the g.region command with an appropriate resolution. Some experimentation might be required. For example use:&lt;br /&gt;
&lt;br /&gt;
 g.region -s -p res=10&lt;br /&gt;
&lt;br /&gt;
which will create a resolution where every pixel on the map represents 10 metres on the ground. Then from the Map Display window icons bar click  the &amp;quot;zoom to...&amp;quot; icon (a magnifying glass over a small map) and from the drop menu select &amp;quot;Set computational region extents to match display&amp;quot;. That's it. You can now safely convert your vector files to raster, as follows:&lt;br /&gt;
&lt;br /&gt;
 v.to.rast input=contours_vect output=contours_rast use=attr \&lt;br /&gt;
    type=line layer=1 column=ELEVATION value=1 rows=4096 &lt;br /&gt;
 &lt;br /&gt;
 v.to.rast input=tracks_vect output=tracks_rast use=val \&lt;br /&gt;
    type=line layer=1 value=1 rows=4096&lt;br /&gt;
&lt;br /&gt;
* '''Creating the elevation profile'''&lt;br /&gt;
&lt;br /&gt;
 r.surf.contour input=contours_rast output=elevmap_raster&lt;br /&gt;
&lt;br /&gt;
Few seconds later it should have completed its job without errors. Then go ahead with:&lt;br /&gt;
&lt;br /&gt;
 r.profile -i input=elevmap_rast output=- null=*&lt;br /&gt;
&lt;br /&gt;
The -i options allows interactive following of the track on the display map by clicking with the left mouse button along the section of the track you are interested in, and a two column list of values will be printed on stdout, containing the distance between points and the elevation. Use any spreadsheet application to plot the values.&lt;br /&gt;
Alternatively, you can omit the -i option and pipe the list of coordinates to r.profile as follows:&lt;br /&gt;
&lt;br /&gt;
The *profile* parameter can be set to comma separated geographic&lt;br /&gt;
coordinates for profile line endpoints. (The interactive flag (*-i*) overrides this option). Alternatively the coordinate pairs can be piped&lt;br /&gt;
from stdin, one comma separated pair per line.&lt;br /&gt;
&lt;br /&gt;
You can get the coordinate pairs from your track vector with&lt;br /&gt;
''v.out.ascii'', and use the ''fs='', option to make the output file&lt;br /&gt;
&amp;quot;comma-separated&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
* '''An alternative''' has been suggested (not tested yet):&lt;br /&gt;
Use the command ''v.drape'' to get profiles on raster maps along lines from vector maps. The command to be executed is something like.&lt;br /&gt;
&lt;br /&gt;
 v.drape input=perfil out=perfil_n_mg type=point rast=eigen \&lt;br /&gt;
    method=cubic&lt;br /&gt;
&lt;br /&gt;
And to convert the profiles to ascii files, like tables, you can run:&lt;br /&gt;
&lt;br /&gt;
 v.out.ascii perfil_n_mg &amp;gt; perfil_n_mg.txt&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;/div&gt;</summary>
		<author><name>⚠️Georgew</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=How_to_create_an_elevation_profile&amp;diff=7943</id>
		<title>How to create an elevation profile</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=How_to_create_an_elevation_profile&amp;diff=7943"/>
		<updated>2008-12-06T19:54:26Z</updated>

		<summary type="html">&lt;p&gt;⚠️Georgew: New page: === Q: ===  How to create an elevation profile from intersecting shapefiles  === A: ===  You want to create an elevation profile for a walking track described in one file, when the only av...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Q: === &lt;br /&gt;
How to create an elevation profile from intersecting shapefiles&lt;br /&gt;
&lt;br /&gt;
=== A: === &lt;br /&gt;
You want to create an elevation profile for a walking track described in one file, when the only available elevation data is contained in another file describing the terrain contours for the same region as the track.&lt;br /&gt;
It is assumed both files are available to GRASS in shapefile format.&lt;br /&gt;
In order to ascertain the elevation along the length of the track, you must calculate the elevation at the points where the track intersects with the contour lines, whose elevation is known.&lt;br /&gt;
GRASS can handle data in both vector and raster form. In this instance we will start with the two shapefiles in vector form, one representing the coordinates of the track, the other the coordinates and the elevation of the contour lines. We will then convert them to raster form in order to establish the elevation at the points where the track intersects the contours, and finally produce the track elevation profile data.&lt;br /&gt;
&lt;br /&gt;
* ''' Importing the shapefiles into GRASS'''&lt;br /&gt;
&lt;br /&gt;
''v.in.ogr -o dsn=/home/george/GRASSDATA/Contour.shp output=contours_vect min_area=0.0001 type=line snap=-1 --overwrite''&lt;br /&gt;
&lt;br /&gt;
''v.in.ogr -o dsn=/home/george/GRASSDATA/Track_cl.shp output=tracks_vect min_area=0.0001 type=line snap=-1 --overwrite ''&lt;br /&gt;
&lt;br /&gt;
At this point you can optionally visualize the map display using the GRASS Display Manager which opens up automatically when you start GRASS.&lt;br /&gt;
&lt;br /&gt;
* '''Set the computational region resolution and convert vector to raster'''&lt;br /&gt;
&lt;br /&gt;
In order to convert the vector files to raster we will use the v.to.rast program.&lt;br /&gt;
However before you proceed you MUST ensure that the computational region is set to the correct resolution. The v.to.rast documentation has an innocent looking warning which reads as follows:&lt;br /&gt;
&lt;br /&gt;
''&amp;quot;v.to.rast will only affect data in areas lying inside the boundaries of the current geographic region. Before running v.to.rast, the user should therefore ensure that the current geographic region is correctly set and that the region resolution is at the desired level.&amp;quot;''&lt;br /&gt;
&lt;br /&gt;
Do not ignore this warning as the most likely outcome will be a useless raster map consisting of large, chunky squares for each pixel.&lt;br /&gt;
To change the resolution of the computational region use the g.region command with an appropriate resolution. Some experimentation might be required. For example use:&lt;br /&gt;
&lt;br /&gt;
''g.region -s -p res=10'' &lt;br /&gt;
&lt;br /&gt;
which will create a resolution where every pixel on the map represents 10 metres on the ground. Then from the Map Display window icons bar click  the &amp;quot;zoom to...&amp;quot; icon (a magnifying glass over a small map) and from the drop menu select &amp;quot;Set computational region extents to match display&amp;quot;. That's it. You can now safely convert your vector files to raster, as follows:&lt;br /&gt;
&lt;br /&gt;
''v.to.rast input=contours_vect@PERMANENT output=contours_rast use=attr type=line layer=1 column=ELEVATION value=1 rows=4096 --overwrite'' &lt;br /&gt;
&lt;br /&gt;
''v.to.rast input=tracks_vect@PERMANENT output=tracks_rast use=val type=line layer=1 value=1 rows=4096 --overwrite'' &lt;br /&gt;
&lt;br /&gt;
* '''Creating the elevation profile'''&lt;br /&gt;
&lt;br /&gt;
''r.surf.contour input=contours_rast@PERMANENT output=elevmap_raster --overwrite''&lt;br /&gt;
&lt;br /&gt;
Few seconds later it should have completed its job without errors. Then go ahead with:&lt;br /&gt;
&lt;br /&gt;
''r.profile -i input=elevmap_rast@PERMANENT output=- null=*''&lt;br /&gt;
&lt;br /&gt;
The -i options allows interactive following of the track on the display map by clicking with the left mouse button along the section of the track you are interested in, and a two column list of values will be printed on stdout, containing the distance between points and the elevation. Use any spreadsheet application to plot the values.&lt;br /&gt;
Alternatively, you can omit the -i option and pipe the list of coordinates to r.profile as follows:&lt;br /&gt;
&lt;br /&gt;
The *profile* parameter can be set to comma separated geographic&lt;br /&gt;
coordinates for profile line endpoints. (The interactive flag (*-i*) overrides this option). Alternatively the coordinate pairs can be piped&lt;br /&gt;
from stdin, one comma separated pair per line.&lt;br /&gt;
&lt;br /&gt;
You can get the coordinate pairs from your track vector with&lt;br /&gt;
''v.out.ascii'', and use the ''fs='', option to make the output file&lt;br /&gt;
&amp;quot;comma-separated&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
* '''An alternative''' has been suggested (not tested yet):&lt;br /&gt;
Use the command ''v.drape'' to get profiles on raster maps along lines from vector maps. The command to be executed is something like.&lt;br /&gt;
&lt;br /&gt;
''v.drape input=perfil out=perfil_n_mg type=point rast=eigen method=cubic&lt;br /&gt;
''&lt;br /&gt;
And to convert the profiles to ascii files, like tables, you can run:&lt;br /&gt;
&lt;br /&gt;
''v.out.ascii perfil_n_mg &amp;gt; perfil_n_mg.txt'' &lt;br /&gt;
[[Category:FAQ]]&lt;/div&gt;</summary>
		<author><name>⚠️Georgew</name></author>
	</entry>
</feed>