<?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%8FErget</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%8FErget"/>
	<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/wiki/Special:Contributions/%E2%9A%A0%EF%B8%8FErget"/>
	<updated>2026-05-13T00:03:44Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=Parallelizing_Scripts&amp;diff=16264</id>
		<title>Parallelizing Scripts</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=Parallelizing_Scripts&amp;diff=16264"/>
		<updated>2012-08-07T14:48:58Z</updated>

		<summary type="html">&lt;p&gt;⚠️Erget: /* Python */ Added another (simple) implementation of a parallelization script&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Bourne shell script ===&lt;br /&gt;
* '''Poor-man's multithreading''' using Bourne shell script &amp;amp; backgrounding. WARNING: not all GRASS modules and scripts are safe to have other things happening in the same mapset while they are running. Try at your own risk after performing a suitable safety audit. e.g. Make sure g.region is not run, externally changing the region settings.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 ### r.sun mode 1 loop ###&lt;br /&gt;
 SUNRISE=7.67&lt;br /&gt;
 SUNSET=16.33&lt;br /&gt;
 STEP=0.01&lt;br /&gt;
 # | wc -l   867&lt;br /&gt;
&lt;br /&gt;
 if [ -z &amp;quot;$WORKERS&amp;quot; ] ; then&lt;br /&gt;
    WORKERS=4&lt;br /&gt;
 fi&lt;br /&gt;
&lt;br /&gt;
 DAY=355&lt;br /&gt;
 for TIME in `seq $SUNRISE $STEP $SUNSET` ; do&lt;br /&gt;
    echo &amp;quot;time=$TIME&amp;quot;&lt;br /&gt;
    CMD=&amp;quot;r.sun -s elevin=gauss day=$DAY time=$TIME \&lt;br /&gt;
          beam_rad=rad1_test.${DAY}_${TIME}_beam --quiet&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    # poor man's multi-threading for a multi-core CPU&lt;br /&gt;
    MODULUS=`echo &amp;quot;$TIME $STEP $WORKERS&amp;quot; | awk '{print $1 % ($2 * $3)}'`&lt;br /&gt;
    if [ &amp;quot;$MODULUS&amp;quot; = &amp;quot;$STEP&amp;quot; ] || [ &amp;quot;$TIME&amp;quot; = &amp;quot;$SUNSET&amp;quot; ] ; then&lt;br /&gt;
       # stall to let the background jobs finish&lt;br /&gt;
       $CMD&lt;br /&gt;
       sleep 2&lt;br /&gt;
       wait&lt;br /&gt;
       #while [ `pgrep -c r.sun` -ne 0 ] ; do&lt;br /&gt;
       #   sleep 5&lt;br /&gt;
       #done&lt;br /&gt;
    else&lt;br /&gt;
      $CMD &amp;amp;&lt;br /&gt;
    fi&lt;br /&gt;
 done&lt;br /&gt;
 wait   # wait for background jobs to finish to avoid race conditions&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* This approach has been used in the {{AddonCmd|r3.in.xyz}} addon script.&lt;br /&gt;
* Another example using r.sun Mode 2 can be found on the [[r.sun]] wiki page.&lt;br /&gt;
* See the {{cmd|i.landsat.rgb|version=65}} and {{cmd|i.oif|version=65}} examples in 6.5svn.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Backgrounding code which sets environment variables with `eval` requires the use of grouping within ()s:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 eval `(&lt;br /&gt;
    r.univar -ge map=&amp;quot;$RED&amp;quot;   percentile=95 | grep '^percentile_' | sed -e 's/^/R_/' &amp;amp;&lt;br /&gt;
    r.univar -ge map=&amp;quot;$GREEN&amp;quot; percentile=95 | grep '^percentile_' | sed -e 's/^/G_/' &amp;amp;&lt;br /&gt;
    r.univar -ge map=&amp;quot;$BLUE&amp;quot;  percentile=95 | grep '^percentile_' | sed -e 's/^/B_/'&lt;br /&gt;
    wait&lt;br /&gt;
 )`&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Python ===&lt;br /&gt;
&lt;br /&gt;
* Due to the &amp;quot;GIL&amp;quot; in Python 2.x-3.0, pure python will only run on a single core, even when multi-threaded. All multithreading schemes &amp;amp; modules for (pure) Python are therefore wrappers around multiple system processes, which are a lot more expensive than threads to create and destroy. Thus it is more efficient to create large high-level Python 'threads' (processes) than to bury them deep inside of a loop.&lt;br /&gt;
&lt;br /&gt;
Example of multiprocessing at the GRASS module level:&lt;br /&gt;
&lt;br /&gt;
Similar to the Bourne shell example above, but using the '''subprocess''' python module.&lt;br /&gt;
The {{Cmd|i.oif|version=70}} script in GRASS7 is using this method.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
bands = [1,2,3,4,5,7]&lt;br /&gt;
&lt;br /&gt;
# run all bands in parallel&lt;br /&gt;
if &amp;quot;WORKERS&amp;quot; in os.environ:&lt;br /&gt;
    workers = int(os.environ[&amp;quot;WORKERS&amp;quot;])&lt;br /&gt;
else:&lt;br /&gt;
    workers = 6&lt;br /&gt;
&lt;br /&gt;
proc = {}&lt;br /&gt;
pout = {}&lt;br /&gt;
&lt;br /&gt;
# spawn jobs in the background&lt;br /&gt;
for band in bands:&lt;br /&gt;
    grass.debug(&amp;quot;band %d, &amp;lt;%s&amp;gt;  %% %d&amp;quot; % (band, image[band], band % workers))&lt;br /&gt;
    proc[band] = grass.pipe_command('r.univar', flags = 'g', map = image[band])&lt;br /&gt;
    if band % workers is 0:&lt;br /&gt;
	# wait for the ones launched so far to finish&lt;br /&gt;
	for bandp in bands[:band]:&lt;br /&gt;
	    if not proc[bandp].stdout.closed:&lt;br /&gt;
		pout[bandp] = proc[bandp].communicate()[0]&lt;br /&gt;
	    proc[bandp].wait()&lt;br /&gt;
&lt;br /&gt;
# wait for jobs to finish, collect the output&lt;br /&gt;
for band in bands:&lt;br /&gt;
    if not proc[band].stdout.closed:&lt;br /&gt;
	pout[band] = proc[band].communicate()[0]&lt;br /&gt;
    proc[band].wait()&lt;br /&gt;
&lt;br /&gt;
# parse the results&lt;br /&gt;
for band in bands:&lt;br /&gt;
    kv = grass.parse_key_val(pout[band])&lt;br /&gt;
    stddev[band] = float(kv['stddev'])&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This can also be accomplished fairly simply by using tracking the number of workers available and using grass.start_command as long as another job can be performed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import os&lt;br /&gt;
import multiprocessing as multi&lt;br /&gt;
&lt;br /&gt;
import grass.script as grass&lt;br /&gt;
&lt;br /&gt;
# Find number of workers that can be used on system. This variable could &lt;br /&gt;
# also be set manually.&lt;br /&gt;
workers = multi.cpu_count()&lt;br /&gt;
# This is only a set of examples for r.slope.aspect jobs where the maps are&lt;br /&gt;
# named serially.&lt;br /&gt;
jobs = range(20)&lt;br /&gt;
&lt;br /&gt;
# Check if workers are already being used&lt;br /&gt;
if workers is 1 and &amp;quot;WORKERS&amp;quot; in os.environ:&lt;br /&gt;
    workers = int(os.environ[&amp;quot;WORKERS&amp;quot;])&lt;br /&gt;
if workers &amp;lt; 1:&lt;br /&gt;
    workers = 1&lt;br /&gt;
&lt;br /&gt;
# Initialize process dictionary&lt;br /&gt;
proc = {}&lt;br /&gt;
&lt;br /&gt;
# Loop over jobs&lt;br /&gt;
for i in range(jobs):&lt;br /&gt;
    # Insert job into dictinoary to keep track of it&lt;br /&gt;
    proc[i] = grass.start_command('r.slope.aspect',&lt;br /&gt;
                                  elevation='elev_' + str(i),&lt;br /&gt;
                                  slope='slope_' + str(i))&lt;br /&gt;
    # If the workers are used up, wait for all of them from the last group to&lt;br /&gt;
    # finish.&lt;br /&gt;
    if i % workers is 0:&lt;br /&gt;
        for j in range(workers):&lt;br /&gt;
            proc.[i - j].wait()&lt;br /&gt;
&lt;br /&gt;
# Make sure all workers are finished.&lt;br /&gt;
for i in range(jobs):&lt;br /&gt;
    if proc[i].wait() is not 0:&lt;br /&gt;
        grass.fatal(_('Problem running analysis on evel_' + str(i) + '.')&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== GNU Parallel ===&lt;br /&gt;
* [http://www.gnu.org/software/parallel/ GNU Parallel] is an advanced version of {{wikipedia|xargs}} which makes it easy to write parallel shell scripts.&lt;br /&gt;
: See also the unrelated C &amp;quot;parallel&amp;quot; program which comes with the Linux &amp;quot;moreutils&amp;quot; package. It is tighter but less featureful than GNU Parallel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 ### r.sun mode 1 loop ###&lt;br /&gt;
 SUNRISE=7.67&lt;br /&gt;
 SUNSET=16.33&lt;br /&gt;
 STEP=0.01&lt;br /&gt;
 # | wc -l   867&lt;br /&gt;
 &lt;br /&gt;
 DAY=355&lt;br /&gt;
&lt;br /&gt;
 seq $SUNRISE $STEP $SUNSET | parallel -j+0 r.sun -s elevin=gauss day=$DAY \&lt;br /&gt;
       time={} beam_rad=rad1_test.${DAY}_{}_beam --quiet&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GNU Parallel can also distribute work to other computers, see the video on how:&lt;br /&gt;
: http://www.youtube.com/watch?v=LlXDtd_pRaY&lt;br /&gt;
&lt;br /&gt;
=== xargs ===&lt;br /&gt;
* {{wikipedia|xargs}} can be told to limit itself to a certain number of processes at once. The r.sun example is almost exactly as with GNU Parallel, except for `-P $CORES -n 1` instead of `-j+0`.&lt;br /&gt;
&lt;br /&gt;
For example, convert a large number of Raster3D maps into 2D rasters:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
  NUM_CORES=6&lt;br /&gt;
  g.mlist rast3d | xargs -P $NUM_CORES -n 1 -I{} \&lt;br /&gt;
     r3.to.rast -r in={} out={} --quiet&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For another example, here we spit apart a PDF and convert each page to a PNG image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
  pdftk pdfmovie.pdf burst&lt;br /&gt;
  NUM_CORES=6&lt;br /&gt;
  ls -1 pg_*.pdf | xargs -P $NUM_CORES -n 1 -I{} \&lt;br /&gt;
     sh -c &amp;quot;pdftoppm {} | pnmcut -width 1280 -height 1024 -left 0 -top 0 | \&lt;br /&gt;
               pnmtopng &amp;gt; \`basename {} .pdf\`.png&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category: Development]]&lt;br /&gt;
[[Category: Parallelization]]&lt;/div&gt;</summary>
		<author><name>⚠️Erget</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=Vector_aggregate_values&amp;diff=15352</id>
		<title>Vector aggregate values</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=Vector_aggregate_values&amp;diff=15352"/>
		<updated>2012-04-11T16:18:28Z</updated>

		<summary type="html">&lt;p&gt;⚠️Erget: /* Method 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
GIS users often wish to aggregate the values of one polygon layer into another. Although this is not integrated as a standard tool in GRASS, it is definitely possible. This article introduces two methods to do just that: A simple, quick operation will be described that can take place entirely in GRASS GIS and produces raster maps or, if desired, polygons with aggregated values from two maps and a second, more complex method that uses external editors and creates text files as outputs.&lt;br /&gt;
&lt;br /&gt;
=== Method 1 ===&lt;br /&gt;
&lt;br /&gt;
''written by Daniel Lee''&lt;br /&gt;
&lt;br /&gt;
In this example we assume that we have a vector map of catchment areas and a raster map of precipitation. We want to find out what the sum total of precipitation per catchment area is. This method would also work if the precipitation data were also stored as vector data, but the vector precipitation data would have to be turned into a raster map, just as the catchment areas are converted to rasters in the following steps. Remember to set the region, etc. in GRASS properly.&lt;br /&gt;
&lt;br /&gt;
''' Step 1: Convert catchment area polygons to rasters '''&lt;br /&gt;
&lt;br /&gt;
The polygons are converted to rasters using v.to.rast. The primary key for the polygons should be used as the values for the new rasters. If the polygons were imported from a shapefile, for example, the field FID could be used.&lt;br /&gt;
&lt;br /&gt;
        v.to.rast input=CatchmentAreas output=CatchmentAreas_Raster column=FID&lt;br /&gt;
&lt;br /&gt;
''' Step 2: Convert precipitation raster to integer values '''&lt;br /&gt;
&lt;br /&gt;
The tool that we will be using later, r.statistics, requires integer values. Because the precipitation raster is composed of floating point values, we have to convert it to an integer map first. In order to avoid rounding areas in the final results, we also multiply the raster by 100. This way we can divide it by 100 later in order to the original float values back.&lt;br /&gt;
If the raster that you want to aggregate into your vectors is already made of integer values or if rounding errors aren't a problem, this step can be changed or left out.&lt;br /&gt;
&lt;br /&gt;
        r.mapcalc 'Precipitation_Integer = round (Precipitation * 100)&lt;br /&gt;
&lt;br /&gt;
''' Step 3: Aggregate the precipitation values by summing them in the catchment areas they fall in '''&lt;br /&gt;
&lt;br /&gt;
Now we have two rasters that can be combined. In order to find the sum of the pixels of the precipitation map we use r.statistics.&lt;br /&gt;
&lt;br /&gt;
        r.statistics base=CatchmentAreas_Raster cover=Precipitation_Integer method=sum output=Precipitation_by_CatchmentArea&lt;br /&gt;
&lt;br /&gt;
''' Step 4: Extract sums from the new map '''&lt;br /&gt;
&lt;br /&gt;
Now the precipitation sums are aggregated by catchment area, but only as attributes and not as categories in the resulting raster. We now extract the aggregated sums, overwriting the previous raster, by using the &amp;quot;@&amp;quot; function in r.mapcalc. Additionally, the map is divided by 100 to scale the values back, reversing the change we made when we turned the original precipitation map into an integer map.&lt;br /&gt;
Don't forget to not divide by 100 if you didn't multiply by 100 in step 2.&lt;br /&gt;
&lt;br /&gt;
        r.mapcalc 'Precipitation_by_CatchmentArea = @Precipitation_by_CatchmentArea / 100'&lt;br /&gt;
&lt;br /&gt;
''' Step 5: Convert the aggregated precipitation raster to a vector map. '''&lt;br /&gt;
&lt;br /&gt;
This procedure should already be familiar for those who work with vector maps. If vectors are not needed, it can be skipped.&lt;br /&gt;
&lt;br /&gt;
        r.to.vect input=Precipitation_by_CatchmentArea output=Precipitation_by_CatchmentArea_Vectors feature=area&lt;br /&gt;
&lt;br /&gt;
In an optional last step one can combine the new vectors, which will probably not be exactly the same as the old vectors, with the old vector attribute table, either with v.db.join or v.distance using e.g. the centroids as spatial join criterium.&lt;br /&gt;
&lt;br /&gt;
=== Method 2 ===&lt;br /&gt;
&lt;br /&gt;
''written by Michael O'Donovan''&lt;br /&gt;
&lt;br /&gt;
GIS users accustomed to proprietary vector-based products (MapInfo, MapMaker, Atlas and some other ESRI) are often disappointed when the try migrating to OpenSource software. Many of the key functions that make vector-based systems so useful are unavailable in OpenSource software like QGIS, Thuban and GRASS. One such function is the ability to aggregate values from one polygon layer to another.&lt;br /&gt;
&lt;br /&gt;
A typical example would be one of aggregating the population of census tracts (or municipalities) to derive the population of a suburb (or province). The aggregation is simply one of adding the tracts together only when the outer edge of some combination of polygons coincide. This happens when tracts are defined in such a way that they coincide with suburb perimeters. However when the boundaries do not coincide the situation usually calls for a vector-based system that will allocate populations according to the location of the tract centroid or the proportion of a tract falling into a particular suburb. The absence of this aggregation feature discourages potential users from adopting OpenSource software like GRASS. The section that follows shows how, with a little bit of preparation, aggregations can be easily performed by GRASS raster functions. It follows a hypothetical example inspired by the proposed redrawing of South Africa's nine provinces which currently dissect many of the 280+ municipalities.  It shows how municipal populations can be re-combined to derive the provincial population by converting the vector features to rasters.&lt;br /&gt;
&lt;br /&gt;
For simplicity it is assumed that the user has two shape files &amp;quot;Municipalities&amp;quot; and &amp;quot;Province&amp;quot;. The &amp;quot;Municipalities&amp;quot; file is linked to a file &amp;quot;Municipalities.dbf&amp;quot; which contains numerous variables including &amp;quot;pop&amp;quot; (its population) and &amp;quot;SHP_FID&amp;quot; (a unique number which identifies each polygon). Both files can be easily imported into GRASS (using v.in.ogr) and displayed along with their variables. Before the vector files can be converted to rasters an unusual preparatory step is required. This entails converting the variables of interest from a value per vector to a value per raster cell. To make this conversion it is necessary to place into the appropriate .dbf file a count of the number of raster cells that will represent that vector. In this example this will enable the user to represent the population not as a number per municipality but as a number per cell. All subsequent aggregations need to be based on these cell values and thus on the cell counts.&lt;br /&gt;
&lt;br /&gt;
The first step in preparation is to calculate the number of cells in each municipality. To do this convert the municipality vector into a raster file. Remember that, unlike vectors which can be linked to a large number of other variables, raster cells take on a single value only. For this step this value must be a number that uniquely identifies each municipality. If the municipality vector was obtained from an ESRI shapefile the field &amp;quot;SHP_FID&amp;quot; doesthe job. From the command line type:&lt;br /&gt;
&lt;br /&gt;
        v.to.rast input=Municipalities output=municipalities use=attr col=SHP_FID&lt;br /&gt;
&lt;br /&gt;
This creates a raster file called &amp;quot;municipalities&amp;quot;. As vectors and raster are of different types there is little prospect of their  names being confused. (Nevertheless vectors are indicated by a starting capital while rasters are kept as lowercase words.) the new raster can be seen by typing... &lt;br /&gt;
&lt;br /&gt;
        d.rast municipalities&lt;br /&gt;
&lt;br /&gt;
If is looks funny change the color scheme using something like...&lt;br /&gt;
&lt;br /&gt;
        r.colors map=municipalities color=random&lt;br /&gt;
and d.rast it again.&lt;br /&gt;
&lt;br /&gt;
The next step requires extracting a count of the number of raster cells in each municipality. Once again this is a simple procedure. To save do this and save the output to a file called &amp;quot;munic_count&amp;quot; type...&lt;br /&gt;
&lt;br /&gt;
        r.stats input=municipalities output=munic_count -c&lt;br /&gt;
&lt;br /&gt;
This will produce a text file with the SHP_FID and a cell count seperated by a space. The final preparatory step is to place the count corresponding to each municipality into the Municipalities.dbf file and to calculate the variables of interest as an amount per cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
This is how you would link the files in OpenOffice if you have not yet set up your data sources and do not know how to use VLOOKUP etc.&lt;br /&gt;
&lt;br /&gt;
# Open the file &amp;quot;munic_count&amp;quot; - it will default to a text page containing the SHP_FID, an open space and the cell count.&lt;br /&gt;
# Convert the open spaces to tabs using &amp;quot;Edit&amp;quot;, &amp;quot;Find and Replace&amp;quot;. Place a space in the &amp;quot;search for&amp;quot; box and \t in the &amp;quot;replace with&amp;quot; boxes. Activate &amp;quot;Regular expressions&amp;quot; and click on &amp;quot;Replace all&amp;quot;.&lt;br /&gt;
# Select all of the data (Ctrl A) and copy it to a clipboard (Ctrl C)&lt;br /&gt;
&lt;br /&gt;
You now have all the data ordered by SHP_FID ready to be pasted into the Municpalities.dbf file. So open the Municipalities.dbf file - it will default to a spreadsheet.&lt;br /&gt;
&lt;br /&gt;
# Make sure that the spreadsheet data is in ascending ordered of SHP_FID. (Select all data other than the headers then go to &amp;quot;Data&amp;quot;, &amp;quot;Sort&amp;quot; and select the appropriate column).&lt;br /&gt;
# Click on to cell at the top of the first unused column and click on &amp;quot;Edit&amp;quot;, &amp;quot;Paste special&amp;quot; and &amp;quot;unformatted text&amp;quot;. The cells values and SHP_FID data should now be placed in the corresponding rows. Check that this has been done.&lt;br /&gt;
&lt;br /&gt;
=== Variables of interest ===&lt;br /&gt;
&lt;br /&gt;
If you are interested in, say, aggregating populations then calculate the population per cell for every municipality. (If your data starts in row 1, population is in column C and the cell count in column K type &amp;quot;=C1/K1&amp;quot;. Copy and then paste the formula into all other rows.) Give the new column an appropraite name, say, &amp;quot;cell_value&amp;quot; and save the file under its original name (i.e. as a .dbf). You may well return at a latter stage and calculate new variables of interest using the cell counts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now proceed with the aggregations.&lt;br /&gt;
&lt;br /&gt;
First convert the Municipalities vector into a raster (again). This time use the cell_value as the attribute of interest. At the command prompt type...&lt;br /&gt;
&lt;br /&gt;
        v.to.rast input=Municipalities output=municipalities use=attr col=cell_value&lt;br /&gt;
&lt;br /&gt;
Note that I gave the output raster the same name as earlier. This will overwrite the original raster thereby minimizing clutter.&lt;br /&gt;
&lt;br /&gt;
Now also convert the Provinces vector to a raster file &lt;br /&gt;
&lt;br /&gt;
        v.to.rast input=Provinces output=provinces use=attr col=SHP_FID&lt;br /&gt;
&lt;br /&gt;
The relationship between the two raster files can now be explored using a number of statistics commands most of which are found under r.statistics. Perhapsthe most important statistics are r.sum and r.average. &lt;br /&gt;
&lt;br /&gt;
The command&lt;br /&gt;
        r.sum municpalities &lt;br /&gt;
&lt;br /&gt;
will give the total of all the cell values in the municipalities raster. This equals the total population of the region. However what is actually required in the sum of the population for each province. To get this we use r.statistics. Unfortunately this script does not work for floating point rasters (which is what you are most likely to have). To overcome this problem create a new raster reflecting the integer value of each cell. To create a file useable for r.statistics use..&lt;br /&gt;
&lt;br /&gt;
        r.mapcalc&lt;br /&gt;
(then enter line-by-line)&lt;br /&gt;
        int_municpal=round(municipalities)&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
If rounding of the cell values to an integer results in a notable decline in accuracy then create a new raster file in which the values are multiplied by ten or a hundred and only then rounded. In latter analysis recall that the units have been dramatically (but precisely) inflated. To do this try &amp;quot;int_munic=round(100*municipalities)&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
To finally aggregate the municipal population to provinces type... &lt;br /&gt;
&lt;br /&gt;
        r.statistics base=provinces cover=int_municipal method=sum output=prov_pop&lt;br /&gt;
&lt;br /&gt;
This creates a new raster &amp;quot;prov_pop&amp;quot; which can be explored using&lt;br /&gt;
&lt;br /&gt;
d.what.vect&lt;br /&gt;
(click on each region of interest)&lt;br /&gt;
&lt;br /&gt;
You will see that the values for each province now equals the sum of all the cells that fall into that province. If you want to list the values so that you can put them into Provinces.dbf (i.e. the vector) use..&lt;br /&gt;
&lt;br /&gt;
        r.stats input=RSA_STATS -l &lt;br /&gt;
&lt;br /&gt;
The output can then be placed into the corresponding data file using a method similar to that above. &lt;br /&gt;
&lt;br /&gt;
r.statistics comes with a range of other functions other than &amp;quot;sum&amp;quot;. These substantially improve the functionality of the method.  Statistics include distribution, average, mode, median, average deviation, standard deviation, variance, skewness, kurtosis, minimum and maximum. For assistance type &amp;quot;man r.statistics&amp;quot; from the command prompt. Additional functionality is gained by r.mapcalc's ability to perform functions on multiple raster files. This, in itself, makes the move to raster-based mapping most promising.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes the above procedure results in a notable loss in accuracy. There are two main sources for this: &lt;br /&gt;
&lt;br /&gt;
The rounding of cell values (to use r.statistics) may be problematic for areas with very small values. If this is the case consider inflating cell values by one of several orders of magnitude.  &lt;br /&gt;
&lt;br /&gt;
When the region was set up a resolution (E-W and N-S) was specified. If this resolution is not fine enough there may be some loss of accuracy through aggregation. Consider increasing the resolution.&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
[[Category:Vector]]&lt;/div&gt;</summary>
		<author><name>⚠️Erget</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=Vector_aggregate_values&amp;diff=14798</id>
		<title>Vector aggregate values</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=Vector_aggregate_values&amp;diff=14798"/>
		<updated>2012-01-25T12:06:25Z</updated>

		<summary type="html">&lt;p&gt;⚠️Erget: /* Method 1 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
GIS users often wish to aggregate the values of one polygon layer into another. Although this is not integrated as a standard tool in GRASS, it is definitely possible. This article introduces two methods to do just that: A simple, quick operation will be described that can take place entirely in GRASS GIS and produces raster maps or, if desired, polygons with aggregated values from two maps and a second, more complex method that uses external editors and creates text files as outputs.&lt;br /&gt;
&lt;br /&gt;
=== Method 1 ===&lt;br /&gt;
&lt;br /&gt;
''written by Daniel Lee''&lt;br /&gt;
&lt;br /&gt;
In this example we assume that we have a vector map of catchment areas and a raster map of precipitation. We want to find out what the sum total of precipitation per catchment area is. This method would also work if the precipitation data were also stored as vector data, but the vector precipitation data would have to be turned into a raster map, just as the catchment areas are converted to rasters in the following steps. Remember to set the region, etc. in GRASS properly.&lt;br /&gt;
&lt;br /&gt;
''' Step 1: Convert catchment area polygons to rasters '''&lt;br /&gt;
&lt;br /&gt;
The polygons are converted to rasters using v.to.rast. The primary key for the polygons should be used as the values for the new rasters. If the polygons were imported from a shapefile, for example, the field FID could be used.&lt;br /&gt;
&lt;br /&gt;
        v.to.rast input=CatchmentAreas output=CatchmentAreas_Raster column=FID&lt;br /&gt;
&lt;br /&gt;
''' Step 2: Convert precipitation raster to integer values '''&lt;br /&gt;
&lt;br /&gt;
The tool that we will be using later, r.statistics, requires integer values. Because the precipitation raster is composed of floating point values, we have to convert it to an integer map first. In order to avoid rounding areas in the final results, we also multiply the raster by 100. This way we can divide it by 100 later in order to the original float values back.&lt;br /&gt;
If the raster that you want to aggregate into your vectors is already made of integer values or if rounding errors aren't a problem, this step can be changed or left out.&lt;br /&gt;
&lt;br /&gt;
        r.mapcalc 'Precipitation_Integer = round (Precipitation * 100)&lt;br /&gt;
&lt;br /&gt;
''' Step 3: Aggregate the precipitation values by summing them in the catchment areas they fall in '''&lt;br /&gt;
&lt;br /&gt;
Now we have two rasters that can be combined. In order to find the sum of the pixels of the precipitation map we use r.statistics.&lt;br /&gt;
&lt;br /&gt;
        r.statistics base=CatchmentAreas_Raster cover=Precipitation_Integer method=sum output=Precipitation_by_CatchmentArea&lt;br /&gt;
&lt;br /&gt;
''' Step 4: Extract sums from the new map '''&lt;br /&gt;
&lt;br /&gt;
Now the precipitation sums are aggregated by catchment area, but only as attributes and not as categories in the resulting raster. We now extract the aggregated sums, overwriting the previous raster, by using the &amp;quot;@&amp;quot; function in r.mapcalc. Additionally, the map is divided by 100 to scale the values back, reversing the change we made when we turned the original precipitation map into an integer map.&lt;br /&gt;
Don't forget to not divide by 100 if you didn't multiply by 100 in step 2.&lt;br /&gt;
&lt;br /&gt;
        r.mapcalc 'Precipitation_by_CatchmentArea = @Precipitation_by_CatchmentArea / 100'&lt;br /&gt;
&lt;br /&gt;
''' Step 5: Convert the aggregated precipitation raster to a vector map. '''&lt;br /&gt;
&lt;br /&gt;
This procedure should already be familiar for those who work with vector maps. If vectors are not needed, it can be skipped.&lt;br /&gt;
&lt;br /&gt;
        r.to.vect input=Precipitation_by_CatchmentArea output=Precipitation_by_CatchmentArea_Vectors feature=area&lt;br /&gt;
&lt;br /&gt;
In an optional last step one can combine the new vectors, which will probably not be exactly the same as the old vectors, with the old vector attribute table, either with v.db.join or v.distance using e.g. the centroids as spatial join criterium.&lt;br /&gt;
&lt;br /&gt;
=== Method 2 ===&lt;br /&gt;
&lt;br /&gt;
''written by Michael O'Donovan''&lt;br /&gt;
&lt;br /&gt;
GIS users accustomed to proprietary vector-based products (MapInfo, MapMaker, Atlas and some other ESRI) are often disappointed when the try migrating to OpenSource software. Many of the key functions that make vector-based systems so useful are unavailable in OpenSource software like QGIS, Thuban and GRASS. One such function is the ability to aggregate values from one polygon layer to another.&lt;br /&gt;
&lt;br /&gt;
A typical example would be one of aggregating the population of census tracts (or municipalities) to derive the population of a suburb (or province). The aggregation is simply one of adding the tracts together only when the outer edge of some combination of polygons coincide. This happens when tracts are defined in such a way that they coincide with suburb perimeters. However when the boundaries do not coincide the situation usually calls for a vector-based system that will allocate populations according to the location of the tract centroid or the proportion of a tract falling into a particular suburb. The absence of this aggregation feature discourages potential users from adopting OpenSource software like GRASS. The section that follows shows how, with a little bit of preparation, aggregations can be easily performed by GRASS raster functions. It follows a hypothetical example inspired by the proposed redrawing of South Africa's nine provinces which currently dissect many of the 280+ municipalities.  It shows how municipal populations can be re-combined to derive the provincial population by converting the vector features to rasters.&lt;br /&gt;
&lt;br /&gt;
For simplicity it is assumed that the user has two shape files &amp;quot;Municipalities&amp;quot; and &amp;quot;Province&amp;quot;. The &amp;quot;Municipalities&amp;quot; file is linked to a file &amp;quot;Municipalities.dbf&amp;quot; which contains numerous variables including &amp;quot;pop&amp;quot; (its population) and &amp;quot;SHP_FID&amp;quot; (a unique number which identifies each polygon). Both files can be easily imported into GRASS (using v.in.ogr) and displayed along with their variables. Before the vector files can be converted to rasters an unusual preparatory step is required. This entails converting the variables of interest from a value per vector to a value per raster cell. To make this conversion it is necessary to place into the appropriate .dbf file a count of the number of raster cells that will represent that vector. In this example this will enable the user to represent the population not as a number per municipality but as a number per cell. All subsequent aggregations need to be based on these cell values and thus on the cell counts.&lt;br /&gt;
&lt;br /&gt;
The first step in preparation is to calculate the number of cells in each municipality. To do this convert the municipality vector into a raster file. Remember that, unlike vectors which can be linked to a large number of other variables, raster cells take on a single value only. For this step this value must be a number that uniquely identifies each municipality. If the municipality vector was obtained from an ESRI shapefile the field &amp;quot;SHP_FID&amp;quot; doesthe job. From the command line type:&lt;br /&gt;
&lt;br /&gt;
        v.to.rast input=Municipalities output=municipalities use=attr col=SHP_FID&lt;br /&gt;
&lt;br /&gt;
This creates a raster file called &amp;quot;municipalities&amp;quot;. As vectors and raster are of different types there is little prospect of their  names being confused. (Nevertheless vectors are indicated by a starting capital while rasters are kept as lowercase words.) the new raster can be seen by typing... &lt;br /&gt;
&lt;br /&gt;
        d.rast municipalities.&lt;br /&gt;
&lt;br /&gt;
If is looks funny change the color scheme using something like...&lt;br /&gt;
&lt;br /&gt;
        r.colors map=municipalities color=random&lt;br /&gt;
and d.rast it again.&lt;br /&gt;
&lt;br /&gt;
The next step requires extracting a count of the number of raster cells in each municipality. Once again this is a simple procedure. To save do this and save the output to a file called &amp;quot;munic_count&amp;quot; type...&lt;br /&gt;
&lt;br /&gt;
        r.stats input=municipalities output=munic_count -c&lt;br /&gt;
&lt;br /&gt;
This will produce a text file with the SHP_FID and a cell count seperated by a space. The final preparatory step is to place the count corresponding to each municipality into the Municipalities.dbf file and to calculate the variables of interest as an amount per cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
This is how you would link the files in OpenOffice if you have not yet set up your data sources and do not know how to use VLOOKUP etc.&lt;br /&gt;
&lt;br /&gt;
# Open the file &amp;quot;munic_count&amp;quot; - it will default to a text page containing the SHP_FID, an open space and the cell count.&lt;br /&gt;
# Convert the open spaces to tabs using &amp;quot;Edit&amp;quot;, &amp;quot;Find and Replace&amp;quot;. Place a space in the &amp;quot;search for&amp;quot; box and \t in the &amp;quot;replace with&amp;quot; boxes. Activate &amp;quot;Regular expressions&amp;quot; and click on &amp;quot;Replace all&amp;quot;.&lt;br /&gt;
# Select all of the data (Ctrl A) and copy it to a clipboard (Ctrl C)&lt;br /&gt;
&lt;br /&gt;
You now have all the data ordered by SHP_FID ready to be pasted into the Municpalities.dbf file. So open the Municipalities.dbf file - it will default to a spreadsheet.&lt;br /&gt;
&lt;br /&gt;
# Make sure that the spreadsheet data is in ascending ordered of SHP_FID. (Select all data other than the headers then go to &amp;quot;Data&amp;quot;, &amp;quot;Sort&amp;quot; and select the appropriate column).&lt;br /&gt;
# Click on to cell at the top of the first unused column and click on &amp;quot;Edit&amp;quot;, &amp;quot;Paste special&amp;quot; and &amp;quot;unformatted text&amp;quot;. The cells values and SHP_FID data should now be placed in the corresponding rows. Check that this has been done.&lt;br /&gt;
&lt;br /&gt;
=== Variables of interest ===&lt;br /&gt;
&lt;br /&gt;
If you are interested in, say, aggregating populations then calculate the population per cell for every municipality. (If your data starts in row 1, population is in column C and the cell count in column K type &amp;quot;=C1/K1&amp;quot;. Copy and then paste the formula into all other rows.) Give the new column an appropraite name, say, &amp;quot;cell_value&amp;quot; and save the file under its original name (i.e. as a .dbf). You may well return at a latter stage and calculate new variables of interest using the cell counts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now proceed with the aggregations.&lt;br /&gt;
&lt;br /&gt;
First convert the Municipalities vector into a raster (again). This time use the cell_value as the attribute of interest. At the command prompt type...&lt;br /&gt;
&lt;br /&gt;
        v.to.rast input=Municipalities output=municipalities use=attr col=cell_value&lt;br /&gt;
&lt;br /&gt;
Note that I gave the output raster the same name as earlier. This will overwrite the original raster thereby minimizing clutter.&lt;br /&gt;
&lt;br /&gt;
Now also convert the Provinces vector to a raster file &lt;br /&gt;
&lt;br /&gt;
        v.to.rast input=Provinces output=provinces use=attr col=SHP_FID&lt;br /&gt;
&lt;br /&gt;
The relationship between the two raster files can now be explored using a number of statistics commands most of which are found under r.statistics. Perhapsthe most important statistics are r.sum and r.average. &lt;br /&gt;
&lt;br /&gt;
The command&lt;br /&gt;
        r.sum municpalities &lt;br /&gt;
&lt;br /&gt;
will give the total of all the cell values in the municipalities raster. This equals the total population of the region. However what is actually required in the sum of the population for each province. To get this we use r.statistics. Unfortunately this script does not work for floating point rasters (which is what you are most likely to have). To overcome this problem create a new raster reflecting the integer value of each cell. To create a file useable for r.statistics use..&lt;br /&gt;
&lt;br /&gt;
        r.mapcalc&lt;br /&gt;
(then enter line-by-line)&lt;br /&gt;
        int_municpal=round(municipalities)&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
If rounding of the cell values to an integer results in a notable decline in accuracy then create a new raster file in which the values are multiplied by ten or a hundred and only then rounded. In latter analysis recall that the units have been dramatically (but precisely) inflated. To do this try &amp;quot;int_munic=round(100*municipalities)&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
To finally aggregate the municipal population to provinces type... &lt;br /&gt;
&lt;br /&gt;
        r.statistics base=provinces cover=int_municipal method=sum output=prov_pop&lt;br /&gt;
&lt;br /&gt;
This creates a new raster &amp;quot;prov_pop&amp;quot; which can be explored using&lt;br /&gt;
&lt;br /&gt;
d.what.vect&lt;br /&gt;
(click on each region of interest)&lt;br /&gt;
&lt;br /&gt;
You will see that the values for each province now equals the sum of all the cells that fall into that province. If you want to list the values so that you can put them into Provinces.dbf (i.e. the vector) use..&lt;br /&gt;
&lt;br /&gt;
        r.stats input=RSA_STATS -l &lt;br /&gt;
&lt;br /&gt;
The output can then be placed into the corresponding data file using a method similar to that above. &lt;br /&gt;
&lt;br /&gt;
r.statistics comes with a range of other functions other than &amp;quot;sum&amp;quot;. These substantially improve the functionality of the method.  Statistics include distribution, average, mode, median, average deviation, standard deviation, variance, skewness, kurtosis, minimum and maximum. For assistance type &amp;quot;man r.statistics&amp;quot; from the command prompt. Additional functionality is gained by r.mapcalc's ability to perform functions on multiple raster files. This, in itself, makes the move to raster-based mapping most promising.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes the above procedure results in a notable loss in accuracy. There are two main sources for this: &lt;br /&gt;
&lt;br /&gt;
The rounding of cell values (to use r.statistics) may be problematic for areas with very small values. If this is the case consider inflating cell values by one of several orders of magnitude.  &lt;br /&gt;
&lt;br /&gt;
When the region was set up a resolution (E-W and N-S) was specified. If this resolution is not fine enough there may be some loss of accuracy through aggregation. Consider increasing the resolution.&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
[[Category:Vector]]&lt;/div&gt;</summary>
		<author><name>⚠️Erget</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=Import_XYZ&amp;diff=14456</id>
		<title>Import XYZ</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=Import_XYZ&amp;diff=14456"/>
		<updated>2011-12-02T17:12:30Z</updated>

		<summary type="html">&lt;p&gt;⚠️Erget: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Import Gridded XYZ DEM data ==&lt;br /&gt;
&lt;br /&gt;
There are a couple of ways to import regular DEM (elevation) data in gridded XYZ ASCII format:&lt;br /&gt;
* use {{cmd|v.in.ascii}}, then  {{cmd|v.to.rast}}&lt;br /&gt;
* use {{cmd|r.in.xyz}} along with {{cmd|g.region}}&lt;br /&gt;
&lt;br /&gt;
By ''gridded'' it is meant that the data covers exactly one x,y,z data point per raster cell. For ''sparse'' data points or grids rotated or of a different resolution compared to the current raster region you should use one of the vector interpolation (e.g. {{cmd|v.surf.rst}}) or raster resampling (e.g. {{cmd|r.resamp.interp}}) modules to fill in any gaps after importing; and adjusting the region by half a cell outwards is not needed.&lt;br /&gt;
For rotated grids, if possible, it is better to import them in their native projection then use {{cmd|r.proj}} to pull them into the target location. For grids of different resolution to the current raster region settings, if possible, it is better to import them in their native resolution.&lt;br /&gt;
&lt;br /&gt;
=== Import with r.in.xyz ===&lt;br /&gt;
&lt;br /&gt;
'''Example:''' We want to import a XYZ ASCII file &amp;quot;VTL2733.XYZ&amp;quot;. First we look at the structure of the file:&lt;br /&gt;
&lt;br /&gt;
  head -n 4 VTL2733.XYZ&lt;br /&gt;
  617000.0 148000.0 157.92&lt;br /&gt;
  617025.0 148000.0 157.82&lt;br /&gt;
  617050.0 148000.0 157.70&lt;br /&gt;
  617075.0 148000.0 157.60&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
It indicates a 25m raster cell size. To import, we run a few commands:&lt;br /&gt;
&lt;br /&gt;
* First scan the map extent in human readable way (reduce white space on the fly, read from standard-input):&lt;br /&gt;
 cat VTL2733.XYZ| r.in.xyz -s in=- fs=space out=test&lt;br /&gt;
 Range:     min         max&lt;br /&gt;
 x: 617000.000000 619250.000000&lt;br /&gt;
 y: 148000.000000 151000.000000&lt;br /&gt;
 z:  149.160000  162.150000&lt;br /&gt;
 &lt;br /&gt;
* set region, get from scanning the file again, now in machine-readable form&lt;br /&gt;
 # (eval and -g flag):&lt;br /&gt;
 eval `cat VTL2733.XYZ | r.in.xyz -s -g in=- fs=space out=test`&lt;br /&gt;
 g.region n=$n s=$s w=$w e=$e res=25 -p&lt;br /&gt;
 &lt;br /&gt;
* enlarge region by half raster cell resolution to store values in cell-center:&lt;br /&gt;
 g.region n=n+12.5 s=s-12.5 w=w-12.5 e=e+12.5 -p&lt;br /&gt;
 &lt;br /&gt;
* verify that the number of rows in the ASCII file corresponds to the number of cells in enlarged region&lt;br /&gt;
 wc -l VTL2733.XYZ&lt;br /&gt;
 &lt;br /&gt;
* finally import as raster map:&lt;br /&gt;
 cat VTL2733.XYZ | r.in.xyz in=- fs=space out=vtl2733&lt;br /&gt;
 &lt;br /&gt;
* and confirm that it all went cleanly, indicated by the absence of NULL cells:&lt;br /&gt;
 r.univar vtl2733&lt;br /&gt;
&lt;br /&gt;
Now you can analyse the imported elevation map or export into a reasonable raster format (e.g., GeoTIFF) with {{cmd|r.out.gdal}}.&lt;br /&gt;
&lt;br /&gt;
Inspecting the output of {{cmd|r.univar}} with r.in.xyz's &amp;lt;tt&amp;gt;method=n&amp;lt;/tt&amp;gt; maps can be very useful for troubleshooting.&lt;br /&gt;
&lt;br /&gt;
=== Import multiple files in one step into a single DEM ===&lt;br /&gt;
&lt;br /&gt;
Just amend above procedure to use wildcards.&lt;br /&gt;
Change in above example all occurencies of&lt;br /&gt;
&lt;br /&gt;
  cat VTL2733.XYZ | ...&lt;br /&gt;
to&lt;br /&gt;
  cat *.XYZ | ...&lt;br /&gt;
&lt;br /&gt;
and use a more reasonable output name of course. That's all to import even thousands of files (tiled DEM) easily.&lt;br /&gt;
&lt;br /&gt;
=== Hint if there are multiple white spaces as separator ===&lt;br /&gt;
&lt;br /&gt;
Sometimes one comes across ASCII tables formatted in unfortunate ways, e.g. like this:&lt;br /&gt;
  617000.0 148000.0  157.92&lt;br /&gt;
  617025.0 148000.0  157.82&lt;br /&gt;
  617050.0 148000.0  157.70&lt;br /&gt;
  617075.0 148000.0  157.60&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
Above mentioned GRASS commands refuse to import directly this file since they require single (and not replicated) field separators.&lt;br /&gt;
&lt;br /&gt;
'''Solution:''' On Unix-based systems, you can get rid of this on the fly and import the XYZ ASCII file to a raster map combining some text tools and GRASS commands. Just amend above procedure to use &amp;quot;tr&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Change&lt;br /&gt;
 cat VTL2733.XYZ | r.in.xyz ...&lt;br /&gt;
to&lt;br /&gt;
 cat VTL2733.XYZ | tr -s ' ' ' ' | r.in.xyz ...&lt;br /&gt;
&lt;br /&gt;
Then proceed as above.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [http://tldp.org/LDP/abs/html/textproc.html Text Processing Commands]&lt;br /&gt;
* [http://www.gnu.org/software/coreutils/manual/html_node/index.html GNU Coreutils]&lt;br /&gt;
* The [[LIDAR]] wiki page (discusses the import of ''sparse'' XYZ datasets)&lt;br /&gt;
* The [http://trac.osgeo.org/grass/browser/grass-addons/raster/r.in.xyz.auto r.in.xyz.auto] add-on script&lt;br /&gt;
* [https://trac.osgeo.org/grass/query?status=new&amp;amp;status=assigned&amp;amp;status=reopened&amp;amp;keywords=%7Er.in.xyz Open support tickets concerning r.in.xyz]&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;br /&gt;
[[Category:FAQ]]&lt;/div&gt;</summary>
		<author><name>⚠️Erget</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=Vector_aggregate_values&amp;diff=14394</id>
		<title>Vector aggregate values</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=Vector_aggregate_values&amp;diff=14394"/>
		<updated>2011-11-15T17:52:21Z</updated>

		<summary type="html">&lt;p&gt;⚠️Erget: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;GIS users often wish toto aggregate the values of one polygon layer into another. Although this is not integrated as a standard tool in GRASS, it is definitely possible. This article introduces two methods to do just that: A simple, quick operation will be described that can take place entirely in GRASS GIS and produces rasters or, if desired, polygons with aggregated values from two maps and a second, more complex method that uses external editors and creates text files as outputs.&lt;br /&gt;
&lt;br /&gt;
'''Method 1:''' (written by Daniel Lee)&lt;br /&gt;
&lt;br /&gt;
In this example we assume that we have a vector map of catchment areas and a raster map of precipitation. We want to find out what the sum total of precipitation per catchment area is. This method would also work if the precipitation data were also stored as vector data, but the vector precipitation data would have to be turned into a raster map, just as the catchment areas are converted to rasters in the following steps. Remember to set the region, etc. in GRASS properly.&lt;br /&gt;
&lt;br /&gt;
''' Step 1: Convert catchment area polygons to rasters '''&lt;br /&gt;
&lt;br /&gt;
The polygons are converted to rasters using v.to.rast. The primary key for the polygons should be used as the values for the new rasters. If the polygons were imported from a shapefile, for example, the field FID could be used.&lt;br /&gt;
&lt;br /&gt;
        v.to.rast input=CatchmentAreas output=CatchmentAreas_Raster column=FID&lt;br /&gt;
&lt;br /&gt;
''' Step 2: Convert precipitation raster to integer values '''&lt;br /&gt;
&lt;br /&gt;
The tool that we will be using later, r.statistics, requires integer values. Because the precipitation raster is composed of floating point values, we have to convert it to an integer map first. In order to avoid rounding areas in the final results, we also multiply the raster by 100. This way we can divide it by 100 later in order to the original float values back.&lt;br /&gt;
If the raster that you want to aggregate into your vectors is already made of integer values or if rounding errors aren't a problem, this step can be changed or left out.&lt;br /&gt;
&lt;br /&gt;
        r.mapcalc 'Precipitation_Integer = round (Precipitation * 100)&lt;br /&gt;
&lt;br /&gt;
''' Step 3: Aggregate the precipitation values by summing them in the catchment areas they fall in '''&lt;br /&gt;
&lt;br /&gt;
Now we have two rasters that can be combined. In order to find the sum of the pixels of the precipitation map we use r.statistics.&lt;br /&gt;
&lt;br /&gt;
        r.statistics base=CatchmentAreas_Raster cover=Precipitation_Integer method=sum output=Precipitation_by_CatchmentArea&lt;br /&gt;
&lt;br /&gt;
''' Step 4: Extract sums from the new map '''&lt;br /&gt;
&lt;br /&gt;
Now the precipitation sums are aggregated by catchment area, but only as attributes and not as categories in the resulting raster. We now extract the aggregated sums, overwriting the previous raster, by using the &amp;quot;@&amp;quot; function in r.mapcalc. Additionally, the map is divided by 100 to scale the values back, reversing the change we made when we turned the original precipitation map into an integer map.&lt;br /&gt;
Don't forget to not divide by 100 if you didn't multiply by 100 in step 2.&lt;br /&gt;
&lt;br /&gt;
        r.mapcalc 'Precipitation_by_CatchmentArea = @Precipitation_by_CatchmentArea / 100'&lt;br /&gt;
&lt;br /&gt;
''' Step 5: Convert the aggregated precipitation raster to a vector map. '''&lt;br /&gt;
&lt;br /&gt;
This procedure should already be familiar for those who work with vector maps. If vectors are not needed, it can be skipped.&lt;br /&gt;
&lt;br /&gt;
        r.to.vect input=Precipitation_by_CatchmentArea output=Precipitation_by_CatchmentArea_Vectors feature=area&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Method 2:''' (written by Michael O'Donovan)&lt;br /&gt;
&lt;br /&gt;
GIS users accustomed to proprietary vector-based products (MapInfo, MapMaker, Atlas and some other ESRI) are often disappointed when the try migrating to OpenSource software. Many of the key functions that make vector-based systems so useful are unavailable in OpenSource software like QGIS, Thuban and GRASS. One such function is the ability to aggregate values from one polygon layer to another.&lt;br /&gt;
&lt;br /&gt;
A typical example would be one of aggregating the population of census tracts (or municipalities) to derive the population of a suburb (or province). The aggregation is simply one of adding the tracts together only when the outer edge of some combination of polygons coincide. This happens when tracts are defined in such a way that they coincide with suburb perimeters. However when the boundaries do not coincide the situation usually calls for a vector-based system that will allocate populations according to the location of the tract centroid or the proportion of a tract falling into a particular suburb. The absence of this aggregation feature discourages potential users from adopting OpenSource software like GRASS. The section that follows shows how, with a little bit of preparation, aggregations can be easily performed by GRASS raster functions. It follows a hypothetical example inspired by the proposed redrawing of South Africa's nine provinces which currently dissect many of the 280+ municipalities.  It shows how municipal populations can be re-combined to derive the provincial population by converting the vector features to rasters.&lt;br /&gt;
&lt;br /&gt;
For simplicity it is assumed that the user has two shape files &amp;quot;Municipalities&amp;quot; and &amp;quot;Province&amp;quot;. The &amp;quot;Municipalities&amp;quot; file is linked to a file &amp;quot;Municipalities.dbf&amp;quot; which contains numerous variables including &amp;quot;pop&amp;quot; (its population) and &amp;quot;SHP_FID&amp;quot; (a unique number which identifies each polygon). Both files can be easily imported into GRASS (using v.in.ogr) and displayed along with their variables. Before the vector files can be converted to rasters an unusual preparatory step is required. This entails converting the variables of interest from a value per vector to a value per raster cell. To make this conversion it is necessary to place into the appropriate .dbf file a count of the number of raster cells that will represent that vector. In this example this will enable the user to represent the population not as a number per municipality but as a number per cell. All subsequent aggregations need to be based on these cell values and thus on the cell counts.&lt;br /&gt;
&lt;br /&gt;
The first step in preparation is to calculate the number of cells in each municipality. To do this convert the municipality vector into a raster file. Remember that, unlike vectors which can be linked to a large number of other variables, raster cells take on a single value only. For this step this value must be a number that uniquely identifies each municipality. If the municipality vector was obtained from an ESRI shapefile the field &amp;quot;SHP_FID&amp;quot; doesthe job. From the command line type:&lt;br /&gt;
&lt;br /&gt;
        v.to.rast input=Municipalities output=municipalities use=attr col=SHP_FID&lt;br /&gt;
&lt;br /&gt;
This creates a raster file called &amp;quot;municipalities&amp;quot;. As vectors and raster are of different types there is little prospect of their  names being confused. (Nevertheless vectors are indicated by a starting capital while rasters are kept as lowercase words.) the new raster can be seen by typing... &lt;br /&gt;
&lt;br /&gt;
        d.rast municipalities.&lt;br /&gt;
&lt;br /&gt;
If is looks funny change the color scheme using something like...&lt;br /&gt;
&lt;br /&gt;
        r.colors map=municipalities color=random&lt;br /&gt;
and d.rast it again.&lt;br /&gt;
&lt;br /&gt;
The next step requires extracting a count of the number of raster cells in each municipality. Once again this is a simple procedure. To save do this and save the output to a file called &amp;quot;munic_count&amp;quot; type...&lt;br /&gt;
&lt;br /&gt;
        r.stats input=municipalities output=munic_count -c&lt;br /&gt;
&lt;br /&gt;
This will produce a text file with the SHP_FID and a cell count seperated by a space. The final preparatory step is to place the count corresponding to each municipality into the Municipalities.dbf file and to calculate the variables of interest as an amount per cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
This is how you would link the files in OpenOffice if you have not yet set up your data sources and do not know how to use VLOOKUP etc.&lt;br /&gt;
&lt;br /&gt;
# Open the file &amp;quot;munic_count&amp;quot; - it will default to a text page containing the SHP_FID, an open space and the cell count.&lt;br /&gt;
# Convert the open spaces to tabs using &amp;quot;Edit&amp;quot;, &amp;quot;Find and Replace&amp;quot;. Place a space in the &amp;quot;search for&amp;quot; box and \t in the &amp;quot;replace with&amp;quot; boxes. Activate &amp;quot;Regular expressions&amp;quot; and click on &amp;quot;Replace all&amp;quot;.&lt;br /&gt;
# Select all of the data (Ctrl A) and copy it to a clipboard (Ctrl C)&lt;br /&gt;
&lt;br /&gt;
You now have all the data ordered by SHP_FID ready to be pasted into the Municpalities.dbf file. So open the Municipalities.dbf file - it will default to a spreadsheet.&lt;br /&gt;
&lt;br /&gt;
# Make sure that the spreadsheet data is in ascending ordered of SHP_FID. (Select all data other than the headers then go to &amp;quot;Data&amp;quot;, &amp;quot;Sort&amp;quot; and select the appropriate column).&lt;br /&gt;
# Click on to cell at the top of the first unused column and click on &amp;quot;Edit&amp;quot;, &amp;quot;Paste special&amp;quot; and &amp;quot;unformatted text&amp;quot;. The cells values and SHP_FID data should now be placed in the corresponding rows. Check that this has been done.&lt;br /&gt;
&lt;br /&gt;
Variables of interest.&lt;br /&gt;
&lt;br /&gt;
If you are interested in, say, aggregating populations then calculate the population per cell for every municipality. (If your data starts in row 1, population is in column C and the cell count in column K type &amp;quot;=C1/K1&amp;quot;. Copy and then paste the formula into all other rows.) Give the new column an appropraite name, say, &amp;quot;cell_value&amp;quot; and save the file under its original name (i.e. as a .dbf). You may well return at a latter stage and calculate new variables of interest using the cell counts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now proceed with the aggregations.&lt;br /&gt;
&lt;br /&gt;
First convert the Municipalities vector into a raster (again). This time use the cell_value as the attribute of interest. At the command prompt type...&lt;br /&gt;
&lt;br /&gt;
        v.to.rast input=Municipalities output=municipalities use=attr col=cell_value&lt;br /&gt;
&lt;br /&gt;
Note that I gave the output raster the same name as earlier. This will overwrite the original raster thereby minimizing clutter.&lt;br /&gt;
&lt;br /&gt;
Now also convert the Provinces vector to a raster file &lt;br /&gt;
&lt;br /&gt;
        v.to.rast input=Provinces output=provinces use=attr col=SHP_FID&lt;br /&gt;
&lt;br /&gt;
The relationship between the two raster files can now be explored using a number of statistics commands most of which are found under r.statistics. Perhapsthe most important statistics are r.sum and r.average. &lt;br /&gt;
&lt;br /&gt;
The command&lt;br /&gt;
        r.sum municpalities &lt;br /&gt;
&lt;br /&gt;
will give the total of all the cell values in the municipalities raster. This equals the total population of the region. However what is actually required in the sum of the population for each province. To get this we use r.statistics. Unfortunately this script does not work for floating point rasters (which is what you are most likely to have). To overcome this problem create a new raster reflecting the integer value of each cell. To create a file useable for r.statistics use..&lt;br /&gt;
&lt;br /&gt;
        r.mapcalc&lt;br /&gt;
(then enter line-by-line)&lt;br /&gt;
        int_municpal=round(municipalities)&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
If rounding of the cell values to an integer results in a notable decline in accuracy then create a new raster file in which the values are multiplied by ten or a hundred and only then rounded. In latter analysis recall that the units have been dramatically (but precisely) inflated. To do this try &amp;quot;int_munic=round(100*municipalities)&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
To finally aggregate the municipal population to provinces type... &lt;br /&gt;
&lt;br /&gt;
        r.statistics base=provinces cover=int_municipal method=sum output=prov_pop&lt;br /&gt;
&lt;br /&gt;
This creates a new raster &amp;quot;prov_pop&amp;quot; which can be explored using&lt;br /&gt;
&lt;br /&gt;
d.what.vect&lt;br /&gt;
(click on each region of interest)&lt;br /&gt;
&lt;br /&gt;
You will see that the values for each province now equals the sum of all the cells that fall into that province. If you want to list the values so that you can put them into Provinces.dbf (i.e. the vector) use..&lt;br /&gt;
&lt;br /&gt;
        r.stats input=RSA_STATS -l &lt;br /&gt;
&lt;br /&gt;
The output can then be placed into the corresponding data file using a method similar to that above. &lt;br /&gt;
&lt;br /&gt;
r.statistics comes with a range of other functions other than &amp;quot;sum&amp;quot;. These substantially improve the functionality of the method.  Statistics include distribution, average, mode, median, average deviation, standard deviation, variance, skewness, kurtosis, minimum and maximum. For assistance type &amp;quot;man r.statistics&amp;quot; from the command prompt. Additional functionality is gained by r.mapcalc's ability to perform functions on multiple raster files. This, in itself, makes the move to raster-based mapping most promising.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes the above procedure results in a notable loss in accuracy. There are two main sources for this: &lt;br /&gt;
&lt;br /&gt;
The rounding of cell values (to use r.statistics) may be problematic for areas with very small values. If this is the case consider inflating cell values by one of several orders of magnitude.  &lt;br /&gt;
&lt;br /&gt;
When the region was set up a resolution (E-W and N-S) was specified. If this resolution is not fine enough there may be some loss of accuracy through aggregation. Consider increasing the resolution.&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;/div&gt;</summary>
		<author><name>⚠️Erget</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=Vector_aggregate_values&amp;diff=14365</id>
		<title>Vector aggregate values</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=Vector_aggregate_values&amp;diff=14365"/>
		<updated>2011-11-07T21:54:44Z</updated>

		<summary type="html">&lt;p&gt;⚠️Erget: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;GIS users often wish toto aggregate the values of one polygon layer into another. Although this is not integrated as a standard tool in GRASS, it is definitely possible. This article introduces two methods to do just that: A simple, quick operation will be described that can take place entirely in GRASS GIS and produces rasters or, if desired, polygons with aggregated values from two maps and a second, more complex method that uses external editors and creates text files as outputs.&lt;br /&gt;
&lt;br /&gt;
'''Method 1:''' (written by Daniel Lee)&lt;br /&gt;
&lt;br /&gt;
In this example we assume that we have a vector map of catchment areas and a raster map of precipitation. We want to find out what the sum total of precipitation per catchment area is. This method would also work if the precipitation data were also stored as vector data, but the vector precipitation data would have to be turned into a raster map, just as the catchment areas are converted to rasters in the following steps. Remember to set the region, etc. in GRASS properly.&lt;br /&gt;
&lt;br /&gt;
''' Step 1: Convert catchment area polygons to rasters '''&lt;br /&gt;
&lt;br /&gt;
The polygons are converted to rasters using v.to.rast. The primary key for the polygons should be used as the values for the new rasters. If the polygons were imported from a shapefile, for example, the field FID could be used.&lt;br /&gt;
&lt;br /&gt;
        v.to.rast input=CatchmentAreas output=CatchmentAreas_Raster column=FID&lt;br /&gt;
&lt;br /&gt;
''' Step 2: Convert precipitation raster to integer values '''&lt;br /&gt;
&lt;br /&gt;
The tool that we will be using later, r.statistics, requires integer values. Because the precipitation raster is composed of floating point values, we have to convert it to an integer map first. In order to avoid rounding areas in the final results, we also multiply the raster by 100. This way we can divide it by 100 later in order to the original float values back.&lt;br /&gt;
If the raster that you want to aggregate into your vectors is already made of integer values or if rounding errors aren't a problem, this step can be changed or left out.&lt;br /&gt;
&lt;br /&gt;
        r.mapcalc 'Precipitation_Integer = round (Precipitation * 100)&lt;br /&gt;
&lt;br /&gt;
''' Step 3: Aggregate the precipitation values by summing them in the catchment areas they fall in '''&lt;br /&gt;
&lt;br /&gt;
Now we have two rasters that can be combined. In order to find the sum of the pixels of the precipitation map we use r.statistics.&lt;br /&gt;
&lt;br /&gt;
        r.statistics base=CatchmentAreas_Raster cover=Precipitation_Integer method=sum output=Precipitation_by_CatchmentArea&lt;br /&gt;
&lt;br /&gt;
''' Step 4: Extract sums from the new map '''&lt;br /&gt;
&lt;br /&gt;
Now the precipitation sums are aggregated by catchment area, but only as attributes and not as categories in the resulting raster. We now extract the aggregated sums, overwriting the previous raster, by using the &amp;quot;@&amp;quot; function in r.mapcalc. Additionally, the map is divided by 100 to scale the values back, reversing the change we made when we turned the original precipitation map into an integer map.&lt;br /&gt;
Don't forget to not divide by 100 if you didn't multiply by 100 in step 2.&lt;br /&gt;
&lt;br /&gt;
        r.mapcalc 'Precipitation_by_CatchmentArea = @Precipitation_by_CatchmentArea / 100'&lt;br /&gt;
&lt;br /&gt;
''' Step 5: Convert the aggregated precipitation raster to a vector map. '''&lt;br /&gt;
&lt;br /&gt;
This procedure should already be familiar for those who work with vector maps. If vectors are not needed, it can be skipped.&lt;br /&gt;
&lt;br /&gt;
        r.to.vect input=Precipitation_by_CatchmentArea output=Precipitation_by_CatchmentArea_Vectors&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Method 2:''' (written by Michael O'Donovan)&lt;br /&gt;
&lt;br /&gt;
GIS users accustomed to proprietary vector-based products (MapInfo, MapMaker, Atlas and some other ESRI) are often disappointed when the try migrating to OpenSource software. Many of the key functions that make vector-based systems so useful are unavailable in OpenSource software like QGIS, Thuban and GRASS. One such function is the ability to aggregate values from one polygon layer to another.&lt;br /&gt;
&lt;br /&gt;
A typical example would be one of aggregating the population of census tracts (or municipalities) to derive the population of a suburb (or province). The aggregation is simply one of adding the tracts together only when the outer edge of some combination of polygons coincide. This happens when tracts are defined in such a way that they coincide with suburb perimeters. However when the boundaries do not coincide the situation usually calls for a vector-based system that will allocate populations according to the location of the tract centroid or the proportion of a tract falling into a particular suburb. The absence of this aggregation feature discourages potential users from adopting OpenSource software like GRASS. The section that follows shows how, with a little bit of preparation, aggregations can be easily performed by GRASS raster functions. It follows a hypothetical example inspired by the proposed redrawing of South Africa's nine provinces which currently dissect many of the 280+ municipalities.  It shows how municipal populations can be re-combined to derive the provincial population by converting the vector features to rasters.&lt;br /&gt;
&lt;br /&gt;
For simplicity it is assumed that the user has two shape files &amp;quot;Municipalities&amp;quot; and &amp;quot;Province&amp;quot;. The &amp;quot;Municipalities&amp;quot; file is linked to a file &amp;quot;Municipalities.dbf&amp;quot; which contains numerous variables including &amp;quot;pop&amp;quot; (its population) and &amp;quot;SHP_FID&amp;quot; (a unique number which identifies each polygon). Both files can be easily imported into GRASS (using v.in.ogr) and displayed along with their variables. Before the vector files can be converted to rasters an unusual preparatory step is required. This entails converting the variables of interest from a value per vector to a value per raster cell. To make this conversion it is necessary to place into the appropriate .dbf file a count of the number of raster cells that will represent that vector. In this example this will enable the user to represent the population not as a number per municipality but as a number per cell. All subsequent aggregations need to be based on these cell values and thus on the cell counts.&lt;br /&gt;
&lt;br /&gt;
The first step in preparation is to calculate the number of cells in each municipality. To do this convert the municipality vector into a raster file. Remember that, unlike vectors which can be linked to a large number of other variables, raster cells take on a single value only. For this step this value must be a number that uniquely identifies each municipality. If the municipality vector was obtained from an ESRI shapefile the field &amp;quot;SHP_FID&amp;quot; doesthe job. From the command line type:&lt;br /&gt;
&lt;br /&gt;
        v.to.rast input=Municipalities output=municipalities use=attr col=SHP_FID&lt;br /&gt;
&lt;br /&gt;
This creates a raster file called &amp;quot;municipalities&amp;quot;. As vectors and raster are of different types there is little prospect of their  names being confused. (Nevertheless vectors are indicated by a starting capital while rasters are kept as lowercase words.) the new raster can be seen by typing... &lt;br /&gt;
&lt;br /&gt;
        d.rast municipalities.&lt;br /&gt;
&lt;br /&gt;
If is looks funny change the color scheme using something like...&lt;br /&gt;
&lt;br /&gt;
        r.colors map=municipalities color=random&lt;br /&gt;
and d.rast it again.&lt;br /&gt;
&lt;br /&gt;
The next step requires extracting a count of the number of raster cells in each municipality. Once again this is a simple procedure. To save do this and save the output to a file called &amp;quot;munic_count&amp;quot; type...&lt;br /&gt;
&lt;br /&gt;
        r.stats input=municipalities output=munic_count -c&lt;br /&gt;
&lt;br /&gt;
This will produce a text file with the SHP_FID and a cell count seperated by a space. The final preparatory step is to place the count corresponding to each municipality into the Municipalities.dbf file and to calculate the variables of interest as an amount per cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
This is how you would link the files in OpenOffice if you have not yet set up your data sources and do not know how to use VLOOKUP etc.&lt;br /&gt;
&lt;br /&gt;
# Open the file &amp;quot;munic_count&amp;quot; - it will default to a text page containing the SHP_FID, an open space and the cell count.&lt;br /&gt;
# Convert the open spaces to tabs using &amp;quot;Edit&amp;quot;, &amp;quot;Find and Replace&amp;quot;. Place a space in the &amp;quot;search for&amp;quot; box and \t in the &amp;quot;replace with&amp;quot; boxes. Activate &amp;quot;Regular expressions&amp;quot; and click on &amp;quot;Replace all&amp;quot;.&lt;br /&gt;
# Select all of the data (Ctrl A) and copy it to a clipboard (Ctrl C)&lt;br /&gt;
&lt;br /&gt;
You now have all the data ordered by SHP_FID ready to be pasted into the Municpalities.dbf file. So open the Municipalities.dbf file - it will default to a spreadsheet.&lt;br /&gt;
&lt;br /&gt;
# Make sure that the spreadsheet data is in ascending ordered of SHP_FID. (Select all data other than the headers then go to &amp;quot;Data&amp;quot;, &amp;quot;Sort&amp;quot; and select the appropriate column).&lt;br /&gt;
# Click on to cell at the top of the first unused column and click on &amp;quot;Edit&amp;quot;, &amp;quot;Paste special&amp;quot; and &amp;quot;unformatted text&amp;quot;. The cells values and SHP_FID data should now be placed in the corresponding rows. Check that this has been done.&lt;br /&gt;
&lt;br /&gt;
Variables of interest.&lt;br /&gt;
&lt;br /&gt;
If you are interested in, say, aggregating populations then calculate the population per cell for every municipality. (If your data starts in row 1, population is in column C and the cell count in column K type &amp;quot;=C1/K1&amp;quot;. Copy and then paste the formula into all other rows.) Give the new column an appropraite name, say, &amp;quot;cell_value&amp;quot; and save the file under its original name (i.e. as a .dbf). You may well return at a latter stage and calculate new variables of interest using the cell counts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now proceed with the aggregations.&lt;br /&gt;
&lt;br /&gt;
First convert the Municipalities vector into a raster (again). This time use the cell_value as the attribute of interest. At the command prompt type...&lt;br /&gt;
&lt;br /&gt;
        v.to.rast input=Municipalities output=municipalities use=attr col=cell_value&lt;br /&gt;
&lt;br /&gt;
Note that I gave the output raster the same name as earlier. This will overwrite the original raster thereby minimizing clutter.&lt;br /&gt;
&lt;br /&gt;
Now also convert the Provinces vector to a raster file &lt;br /&gt;
&lt;br /&gt;
        v.to.rast input=Provinces output=provinces use=attr col=SHP_FID&lt;br /&gt;
&lt;br /&gt;
The relationship between the two raster files can now be explored using a number of statistics commands most of which are found under r.statistics. Perhapsthe most important statistics are r.sum and r.average. &lt;br /&gt;
&lt;br /&gt;
The command&lt;br /&gt;
        r.sum municpalities &lt;br /&gt;
&lt;br /&gt;
will give the total of all the cell values in the municipalities raster. This equals the total population of the region. However what is actually required in the sum of the population for each province. To get this we use r.statistics. Unfortunately this script does not work for floating point rasters (which is what you are most likely to have). To overcome this problem create a new raster reflecting the integer value of each cell. To create a file useable for r.statistics use..&lt;br /&gt;
&lt;br /&gt;
        r.mapcalc&lt;br /&gt;
(then enter line-by-line)&lt;br /&gt;
        int_municpal=round(municipalities)&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
If rounding of the cell values to an integer results in a notable decline in accuracy then create a new raster file in which the values are multiplied by ten or a hundred and only then rounded. In latter analysis recall that the units have been dramatically (but precisely) inflated. To do this try &amp;quot;int_munic=round(100*municipalities)&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
To finally aggregate the municipal population to provinces type... &lt;br /&gt;
&lt;br /&gt;
        r.statistics base=provinces cover=int_municipal method=sum output=prov_pop&lt;br /&gt;
&lt;br /&gt;
This creates a new raster &amp;quot;prov_pop&amp;quot; which can be explored using&lt;br /&gt;
&lt;br /&gt;
d.what.vect&lt;br /&gt;
(click on each region of interest)&lt;br /&gt;
&lt;br /&gt;
You will see that the values for each province now equals the sum of all the cells that fall into that province. If you want to list the values so that you can put them into Provinces.dbf (i.e. the vector) use..&lt;br /&gt;
&lt;br /&gt;
        r.stats input=RSA_STATS -l &lt;br /&gt;
&lt;br /&gt;
The output can then be placed into the corresponding data file using a method similar to that above. &lt;br /&gt;
&lt;br /&gt;
r.statistics comes with a range of other functions other than &amp;quot;sum&amp;quot;. These substantially improve the functionality of the method.  Statistics include distribution, average, mode, median, average deviation, standard deviation, variance, skewness, kurtosis, minimum and maximum. For assistance type &amp;quot;man r.statistics&amp;quot; from the command prompt. Additional functionality is gained by r.mapcalc's ability to perform functions on multiple raster files. This, in itself, makes the move to raster-based mapping most promising.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes the above procedure results in a notable loss in accuracy. There are two main sources for this: &lt;br /&gt;
&lt;br /&gt;
The rounding of cell values (to use r.statistics) may be problematic for areas with very small values. If this is the case consider inflating cell values by one of several orders of magnitude.  &lt;br /&gt;
&lt;br /&gt;
When the region was set up a resolution (E-W and N-S) was specified. If this resolution is not fine enough there may be some loss of accuracy through aggregation. Consider increasing the resolution.&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;/div&gt;</summary>
		<author><name>⚠️Erget</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=Vector_aggregate_values&amp;diff=14364</id>
		<title>Vector aggregate values</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=Vector_aggregate_values&amp;diff=14364"/>
		<updated>2011-11-07T21:53:21Z</updated>

		<summary type="html">&lt;p&gt;⚠️Erget: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;GIS users often wish toto aggregate the values of one polygon layer into another. Although this is not integrated as a standard tool in GRASS, it is definitely possible. This article introduces two methods to do just that: A simple, quick operation will be described that can take place entirely in GRASS GIS and produces rasters or, if desired, polygons with aggregated values from two maps and a second, more complex method that uses external editors and creates text files as outputs.&lt;br /&gt;
&lt;br /&gt;
'''Method 1:''' (written by Daniel Lee)&lt;br /&gt;
&lt;br /&gt;
In this example we assume that we have a vector map of catchment areas and a raster map of precipitation. We want to find out what the sum total of precipitation per catchment area is. This method would also work if the precipitation data were also stored as vector data, but the vector precipitation data would have to be turned into a raster map, just as the catchment areas are converted to rasters in the following steps. Remember to set the region, etc. in GRASS properly.&lt;br /&gt;
&lt;br /&gt;
''' Step 1: Convert catchment area polygons to rasters '''&lt;br /&gt;
The polygons are converted to rasters using v.to.rast. The primary key for the polygons should be used as the values for the new rasters. If the polygons were imported from a shapefile, for example, the field FID could be used.&lt;br /&gt;
&lt;br /&gt;
        v.to.rast input=CatchmentAreas output=CatchmentAreas_Raster column=FID&lt;br /&gt;
&lt;br /&gt;
''' Step 2: Convert precipitation raster to integer values '''&lt;br /&gt;
The tool that we will be using later, r.statistics, requires integer values. Because the precipitation raster is composed of floating point values, we have to convert it to an integer map first. In order to avoid rounding areas in the final results, we also multiply the raster by 100. This way we can divide it by 100 later in order to the original float values back.&lt;br /&gt;
If the raster that you want to aggregate into your vectors is already made of integer values or if rounding errors aren't a problem, this step can be changed or left out.&lt;br /&gt;
&lt;br /&gt;
        r.mapcalc 'Precipitation_Integer = round (Precipitation * 100)&lt;br /&gt;
&lt;br /&gt;
''' Step 3: Aggregate the precipitation values by summing them in the catchment areas they fall in '''&lt;br /&gt;
Now we have two rasters that can be combined. In order to find the sum of the pixels of the precipitation map we use r.statistics.&lt;br /&gt;
&lt;br /&gt;
        r.statistics base=CatchmentAreas_Raster cover=Precipitation_Integer method=sum output=Precipitation_by_CatchmentArea&lt;br /&gt;
&lt;br /&gt;
''' Step 4: Extract sums from the new map '''&lt;br /&gt;
Now the precipitation sums are aggregated by catchment area, but only as attributes and not as categories in the resulting raster. We now extract the aggregated sums, overwriting the previous raster, by using the &amp;quot;@&amp;quot; function in r.mapcalc. Additionally, the map is divided by 100 to scale the values back, reversing the change we made when we turned the original precipitation map into an integer map.&lt;br /&gt;
Don't forget to not divide by 100 if you didn't multiply by 100 in step 2.&lt;br /&gt;
&lt;br /&gt;
        r.mapcalc 'Precipitation_by_CatchmentArea = @Precipitation_by_CatchmentArea / 100'&lt;br /&gt;
&lt;br /&gt;
''' Step 5: Convert the aggregated precipitation raster to a vector map. '''&lt;br /&gt;
This procedure should already be familiar for those who work with vector maps. If vectors are not needed, it can be skipped.&lt;br /&gt;
&lt;br /&gt;
        r.to.vect input=Precipitation_by_CatchmentArea output=Precipitation_by_CatchmentArea_Vectors&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Method 2:''' (written by Michael O'Donovan)&lt;br /&gt;
&lt;br /&gt;
GIS users accustomed to proprietary vector-based products (MapInfo, MapMaker, Atlas and some other ESRI) are often disappointed when the try migrating to OpenSource software. Many of the key functions that make vector-based systems so useful are unavailable in OpenSource software like QGIS, Thuban and GRASS. One such function is the ability to aggregate values from one polygon layer to another.&lt;br /&gt;
&lt;br /&gt;
A typical example would be one of aggregating the population of census tracts (or municipalities) to derive the population of a suburb (or province). The aggregation is simply one of adding the tracts together only when the outer edge of some combination of polygons coincide. This happens when tracts are defined in such a way that they coincide with suburb perimeters. However when the boundaries do not coincide the situation usually calls for a vector-based system that will allocate populations according to the location of the tract centroid or the proportion of a tract falling into a particular suburb. The absence of this aggregation feature discourages potential users from adopting OpenSource software like GRASS. The section that follows shows how, with a little bit of preparation, aggregations can be easily performed by GRASS raster functions. It follows a hypothetical example inspired by the proposed redrawing of South Africa's nine provinces which currently dissect many of the 280+ municipalities.  It shows how municipal populations can be re-combined to derive the provincial population by converting the vector features to rasters.&lt;br /&gt;
&lt;br /&gt;
For simplicity it is assumed that the user has two shape files &amp;quot;Municipalities&amp;quot; and &amp;quot;Province&amp;quot;. The &amp;quot;Municipalities&amp;quot; file is linked to a file &amp;quot;Municipalities.dbf&amp;quot; which contains numerous variables including &amp;quot;pop&amp;quot; (its population) and &amp;quot;SHP_FID&amp;quot; (a unique number which identifies each polygon). Both files can be easily imported into GRASS (using v.in.ogr) and displayed along with their variables. Before the vector files can be converted to rasters an unusual preparatory step is required. This entails converting the variables of interest from a value per vector to a value per raster cell. To make this conversion it is necessary to place into the appropriate .dbf file a count of the number of raster cells that will represent that vector. In this example this will enable the user to represent the population not as a number per municipality but as a number per cell. All subsequent aggregations need to be based on these cell values and thus on the cell counts.&lt;br /&gt;
&lt;br /&gt;
The first step in preparation is to calculate the number of cells in each municipality. To do this convert the municipality vector into a raster file. Remember that, unlike vectors which can be linked to a large number of other variables, raster cells take on a single value only. For this step this value must be a number that uniquely identifies each municipality. If the municipality vector was obtained from an ESRI shapefile the field &amp;quot;SHP_FID&amp;quot; doesthe job. From the command line type:&lt;br /&gt;
&lt;br /&gt;
        v.to.rast input=Municipalities output=municipalities use=attr col=SHP_FID&lt;br /&gt;
&lt;br /&gt;
This creates a raster file called &amp;quot;municipalities&amp;quot;. As vectors and raster are of different types there is little prospect of their  names being confused. (Nevertheless vectors are indicated by a starting capital while rasters are kept as lowercase words.) the new raster can be seen by typing... &lt;br /&gt;
&lt;br /&gt;
        d.rast municipalities.&lt;br /&gt;
&lt;br /&gt;
If is looks funny change the color scheme using something like...&lt;br /&gt;
&lt;br /&gt;
        r.colors map=municipalities color=random&lt;br /&gt;
and d.rast it again.&lt;br /&gt;
&lt;br /&gt;
The next step requires extracting a count of the number of raster cells in each municipality. Once again this is a simple procedure. To save do this and save the output to a file called &amp;quot;munic_count&amp;quot; type...&lt;br /&gt;
&lt;br /&gt;
        r.stats input=municipalities output=munic_count -c&lt;br /&gt;
&lt;br /&gt;
This will produce a text file with the SHP_FID and a cell count seperated by a space. The final preparatory step is to place the count corresponding to each municipality into the Municipalities.dbf file and to calculate the variables of interest as an amount per cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
This is how you would link the files in OpenOffice if you have not yet set up your data sources and do not know how to use VLOOKUP etc.&lt;br /&gt;
&lt;br /&gt;
# Open the file &amp;quot;munic_count&amp;quot; - it will default to a text page containing the SHP_FID, an open space and the cell count.&lt;br /&gt;
# Convert the open spaces to tabs using &amp;quot;Edit&amp;quot;, &amp;quot;Find and Replace&amp;quot;. Place a space in the &amp;quot;search for&amp;quot; box and \t in the &amp;quot;replace with&amp;quot; boxes. Activate &amp;quot;Regular expressions&amp;quot; and click on &amp;quot;Replace all&amp;quot;.&lt;br /&gt;
# Select all of the data (Ctrl A) and copy it to a clipboard (Ctrl C)&lt;br /&gt;
&lt;br /&gt;
You now have all the data ordered by SHP_FID ready to be pasted into the Municpalities.dbf file. So open the Municipalities.dbf file - it will default to a spreadsheet.&lt;br /&gt;
&lt;br /&gt;
# Make sure that the spreadsheet data is in ascending ordered of SHP_FID. (Select all data other than the headers then go to &amp;quot;Data&amp;quot;, &amp;quot;Sort&amp;quot; and select the appropriate column).&lt;br /&gt;
# Click on to cell at the top of the first unused column and click on &amp;quot;Edit&amp;quot;, &amp;quot;Paste special&amp;quot; and &amp;quot;unformatted text&amp;quot;. The cells values and SHP_FID data should now be placed in the corresponding rows. Check that this has been done.&lt;br /&gt;
&lt;br /&gt;
Variables of interest.&lt;br /&gt;
&lt;br /&gt;
If you are interested in, say, aggregating populations then calculate the population per cell for every municipality. (If your data starts in row 1, population is in column C and the cell count in column K type &amp;quot;=C1/K1&amp;quot;. Copy and then paste the formula into all other rows.) Give the new column an appropraite name, say, &amp;quot;cell_value&amp;quot; and save the file under its original name (i.e. as a .dbf). You may well return at a latter stage and calculate new variables of interest using the cell counts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now proceed with the aggregations.&lt;br /&gt;
&lt;br /&gt;
First convert the Municipalities vector into a raster (again). This time use the cell_value as the attribute of interest. At the command prompt type...&lt;br /&gt;
&lt;br /&gt;
        v.to.rast input=Municipalities output=municipalities use=attr col=cell_value&lt;br /&gt;
&lt;br /&gt;
Note that I gave the output raster the same name as earlier. This will overwrite the original raster thereby minimizing clutter.&lt;br /&gt;
&lt;br /&gt;
Now also convert the Provinces vector to a raster file &lt;br /&gt;
&lt;br /&gt;
        v.to.rast input=Provinces output=provinces use=attr col=SHP_FID&lt;br /&gt;
&lt;br /&gt;
The relationship between the two raster files can now be explored using a number of statistics commands most of which are found under r.statistics. Perhapsthe most important statistics are r.sum and r.average. &lt;br /&gt;
&lt;br /&gt;
The command&lt;br /&gt;
        r.sum municpalities &lt;br /&gt;
&lt;br /&gt;
will give the total of all the cell values in the municipalities raster. This equals the total population of the region. However what is actually required in the sum of the population for each province. To get this we use r.statistics. Unfortunately this script does not work for floating point rasters (which is what you are most likely to have). To overcome this problem create a new raster reflecting the integer value of each cell. To create a file useable for r.statistics use..&lt;br /&gt;
&lt;br /&gt;
        r.mapcalc&lt;br /&gt;
(then enter line-by-line)&lt;br /&gt;
        int_municpal=round(municipalities)&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
If rounding of the cell values to an integer results in a notable decline in accuracy then create a new raster file in which the values are multiplied by ten or a hundred and only then rounded. In latter analysis recall that the units have been dramatically (but precisely) inflated. To do this try &amp;quot;int_munic=round(100*municipalities)&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
To finally aggregate the municipal population to provinces type... &lt;br /&gt;
&lt;br /&gt;
        r.statistics base=provinces cover=int_municipal method=sum output=prov_pop&lt;br /&gt;
&lt;br /&gt;
This creates a new raster &amp;quot;prov_pop&amp;quot; which can be explored using&lt;br /&gt;
&lt;br /&gt;
d.what.vect&lt;br /&gt;
(click on each region of interest)&lt;br /&gt;
&lt;br /&gt;
You will see that the values for each province now equals the sum of all the cells that fall into that province. If you want to list the values so that you can put them into Provinces.dbf (i.e. the vector) use..&lt;br /&gt;
&lt;br /&gt;
        r.stats input=RSA_STATS -l &lt;br /&gt;
&lt;br /&gt;
The output can then be placed into the corresponding data file using a method similar to that above. &lt;br /&gt;
&lt;br /&gt;
r.statistics comes with a range of other functions other than &amp;quot;sum&amp;quot;. These substantially improve the functionality of the method.  Statistics include distribution, average, mode, median, average deviation, standard deviation, variance, skewness, kurtosis, minimum and maximum. For assistance type &amp;quot;man r.statistics&amp;quot; from the command prompt. Additional functionality is gained by r.mapcalc's ability to perform functions on multiple raster files. This, in itself, makes the move to raster-based mapping most promising.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes the above procedure results in a notable loss in accuracy. There are two main sources for this: &lt;br /&gt;
&lt;br /&gt;
The rounding of cell values (to use r.statistics) may be problematic for areas with very small values. If this is the case consider inflating cell values by one of several orders of magnitude.  &lt;br /&gt;
&lt;br /&gt;
When the region was set up a resolution (E-W and N-S) was specified. If this resolution is not fine enough there may be some loss of accuracy through aggregation. Consider increasing the resolution.&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;/div&gt;</summary>
		<author><name>⚠️Erget</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=Vector_aggregate_values&amp;diff=14363</id>
		<title>Vector aggregate values</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=Vector_aggregate_values&amp;diff=14363"/>
		<updated>2011-11-07T21:49:59Z</updated>

		<summary type="html">&lt;p&gt;⚠️Erget: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;GIS users often wish toto aggregate the values of one polygon layer into another. Although this is not integrated as a standard tool in GRASS, it is definitely possible. This article introduces two methods to do just that: A simple, quick operation will be described that can take place entirely in GRASS GIS and produces rasters or, if desired, polygons with aggregated values from two maps and a second, more complex method that uses external editors and creates text files as outputs.&lt;br /&gt;
&lt;br /&gt;
'''Method 1:''' (written by Daniel Lee)&lt;br /&gt;
In this example we assume that we have a vector map of catchment areas and a raster map of precipitation. We want to find out what the sum total of precipitation per catchment area is. This method would also work if the precipitation data were also stored as vector data, but the vector precipitation data would have to be turned into a raster map, just as the catchment areas are converted to rasters in the following steps. Remember to set the region, etc. in GRASS properly.&lt;br /&gt;
&lt;br /&gt;
Step 1: Convert catchment area polygons to rasters&lt;br /&gt;
The polygons are converted to rasters using v.to.rast. The primary key for the polygons should be used as the values for the new rasters. If the polygons were imported from a shapefile, for example, the field FID could be used.&lt;br /&gt;
&lt;br /&gt;
v.to.rast input=CatchmentAreas output=CatchmentAreas_Raster column=FID&lt;br /&gt;
&lt;br /&gt;
Step 2: Convert precipitation raster to integer values&lt;br /&gt;
The tool that we will be using later, r.statistics, requires integer values. Because the precipitation raster is composed of floating point values, we have to convert it to an integer map first. In order to avoid rounding areas in the final results, we also multiply the raster by 100. This way we can divide it by 100 later in order to the original float values back.&lt;br /&gt;
If the raster that you want to aggregate into your vectors is already made of integer values or if rounding errors aren't a problem, this step can be changed or left out.&lt;br /&gt;
&lt;br /&gt;
r.mapcalc 'Precipitation_Integer = round (Precipitation * 100)&lt;br /&gt;
&lt;br /&gt;
Step 3: Aggregate the precipitation values by summing them in the catchment areas they fall in&lt;br /&gt;
Now we have two rasters that can be combined. In order to find the sum of the pixels of the precipitation map we use r.statistics.&lt;br /&gt;
&lt;br /&gt;
r.statistics base=CatchmentAreas_Raster cover=Precipitation_Integer method=sum output=Precipitation_by_CatchmentArea&lt;br /&gt;
&lt;br /&gt;
Step 4: Extract sums from the new map&lt;br /&gt;
Now the precipitation sums are aggregated by catchment area, but only as attributes and not as categories in the resulting raster. We now extract the aggregated sums, overwriting the previous raster, by using the &amp;quot;@&amp;quot; function in r.mapcalc. Additionally, the map is divided by 100 to scale the values back, reversing the change we made when we turned the original precipitation map into an integer map.&lt;br /&gt;
Don't forget to not divide by 100 if you didn't multiply by 100 in step 2.&lt;br /&gt;
&lt;br /&gt;
r.mapcalc 'Precipitation_by_CatchmentArea = @Precipitation_by_CatchmentArea / 100'&lt;br /&gt;
&lt;br /&gt;
Step 5: Convert the aggregated precipitation raster to a vector map.&lt;br /&gt;
This procedure should already be familiar for those who work with vector maps. If vectors are not needed, it can be skipped.&lt;br /&gt;
&lt;br /&gt;
r.to.vect input=Precipitation_by_CatchmentArea output=Precipitation_by_CatchmentArea_Vectors&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Method 2:''' (written by Michael O'Donovan)&lt;br /&gt;
&lt;br /&gt;
GIS users accustomed to proprietary vector-based products (MapInfo, MapMaker, Atlas and some other ESRI) are often disappointed when the try migrating to OpenSource software. Many of the key functions that make vector-based systems so useful are unavailable in OpenSource software like QGIS, Thuban and GRASS. One such function is the ability to aggregate values from one polygon layer to another.&lt;br /&gt;
&lt;br /&gt;
A typical example would be one of aggregating the population of census tracts (or municipalities) to derive the population of a suburb (or province). The aggregation is simply one of adding the tracts together only when the outer edge of some combination of polygons coincide. This happens when tracts are defined in such a way that they coincide with suburb perimeters. However when the boundaries do not coincide the situation usually calls for a vector-based system that will allocate populations according to the location of the tract centroid or the proportion of a tract falling into a particular suburb. The absence of this aggregation feature discourages potential users from adopting OpenSource software like GRASS. The section that follows shows how, with a little bit of preparation, aggregations can be easily performed by GRASS raster functions. It follows a hypothetical example inspired by the proposed redrawing of South Africa's nine provinces which currently dissect many of the 280+ municipalities.  It shows how municipal populations can be re-combined to derive the provincial population by converting the vector features to rasters.&lt;br /&gt;
&lt;br /&gt;
For simplicity it is assumed that the user has two shape files &amp;quot;Municipalities&amp;quot; and &amp;quot;Province&amp;quot;. The &amp;quot;Municipalities&amp;quot; file is linked to a file &amp;quot;Municipalities.dbf&amp;quot; which contains numerous variables including &amp;quot;pop&amp;quot; (its population) and &amp;quot;SHP_FID&amp;quot; (a unique number which identifies each polygon). Both files can be easily imported into GRASS (using v.in.ogr) and displayed along with their variables. Before the vector files can be converted to rasters an unusual preparatory step is required. This entails converting the variables of interest from a value per vector to a value per raster cell. To make this conversion it is necessary to place into the appropriate .dbf file a count of the number of raster cells that will represent that vector. In this example this will enable the user to represent the population not as a number per municipality but as a number per cell. All subsequent aggregations need to be based on these cell values and thus on the cell counts.&lt;br /&gt;
&lt;br /&gt;
The first step in preparation is to calculate the number of cells in each municipality. To do this convert the municipality vector into a raster file. Remember that, unlike vectors which can be linked to a large number of other variables, raster cells take on a single value only. For this step this value must be a number that uniquely identifies each municipality. If the municipality vector was obtained from an ESRI shapefile the field &amp;quot;SHP_FID&amp;quot; doesthe job. From the command line type:&lt;br /&gt;
&lt;br /&gt;
        v.to.rast input=Municipalities output=municipalities use=attr col=SHP_FID&lt;br /&gt;
&lt;br /&gt;
This creates a raster file called &amp;quot;municipalities&amp;quot;. As vectors and raster are of different types there is little prospect of their  names being confused. (Nevertheless vectors are indicated by a starting capital while rasters are kept as lowercase words.) the new raster can be seen by typing... &lt;br /&gt;
&lt;br /&gt;
        d.rast municipalities.&lt;br /&gt;
&lt;br /&gt;
If is looks funny change the color scheme using something like...&lt;br /&gt;
&lt;br /&gt;
        r.colors map=municipalities color=random&lt;br /&gt;
and d.rast it again.&lt;br /&gt;
&lt;br /&gt;
The next step requires extracting a count of the number of raster cells in each municipality. Once again this is a simple procedure. To save do this and save the output to a file called &amp;quot;munic_count&amp;quot; type...&lt;br /&gt;
&lt;br /&gt;
        r.stats input=municipalities output=munic_count -c&lt;br /&gt;
&lt;br /&gt;
This will produce a text file with the SHP_FID and a cell count seperated by a space. The final preparatory step is to place the count corresponding to each municipality into the Municipalities.dbf file and to calculate the variables of interest as an amount per cell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
This is how you would link the files in OpenOffice if you have not yet set up your data sources and do not know how to use VLOOKUP etc.&lt;br /&gt;
&lt;br /&gt;
# Open the file &amp;quot;munic_count&amp;quot; - it will default to a text page containing the SHP_FID, an open space and the cell count.&lt;br /&gt;
# Convert the open spaces to tabs using &amp;quot;Edit&amp;quot;, &amp;quot;Find and Replace&amp;quot;. Place a space in the &amp;quot;search for&amp;quot; box and \t in the &amp;quot;replace with&amp;quot; boxes. Activate &amp;quot;Regular expressions&amp;quot; and click on &amp;quot;Replace all&amp;quot;.&lt;br /&gt;
# Select all of the data (Ctrl A) and copy it to a clipboard (Ctrl C)&lt;br /&gt;
&lt;br /&gt;
You now have all the data ordered by SHP_FID ready to be pasted into the Municpalities.dbf file. So open the Municipalities.dbf file - it will default to a spreadsheet.&lt;br /&gt;
&lt;br /&gt;
# Make sure that the spreadsheet data is in ascending ordered of SHP_FID. (Select all data other than the headers then go to &amp;quot;Data&amp;quot;, &amp;quot;Sort&amp;quot; and select the appropriate column).&lt;br /&gt;
# Click on to cell at the top of the first unused column and click on &amp;quot;Edit&amp;quot;, &amp;quot;Paste special&amp;quot; and &amp;quot;unformatted text&amp;quot;. The cells values and SHP_FID data should now be placed in the corresponding rows. Check that this has been done.&lt;br /&gt;
&lt;br /&gt;
Variables of interest.&lt;br /&gt;
&lt;br /&gt;
If you are interested in, say, aggregating populations then calculate the population per cell for every municipality. (If your data starts in row 1, population is in column C and the cell count in column K type &amp;quot;=C1/K1&amp;quot;. Copy and then paste the formula into all other rows.) Give the new column an appropraite name, say, &amp;quot;cell_value&amp;quot; and save the file under its original name (i.e. as a .dbf). You may well return at a latter stage and calculate new variables of interest using the cell counts. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now proceed with the aggregations.&lt;br /&gt;
&lt;br /&gt;
First convert the Municipalities vector into a raster (again). This time use the cell_value as the attribute of interest. At the command prompt type...&lt;br /&gt;
&lt;br /&gt;
        v.to.rast input=Municipalities output=municipalities use=attr col=cell_value&lt;br /&gt;
&lt;br /&gt;
Note that I gave the output raster the same name as earlier. This will overwrite the original raster thereby minimizing clutter.&lt;br /&gt;
&lt;br /&gt;
Now also convert the Provinces vector to a raster file &lt;br /&gt;
&lt;br /&gt;
        v.to.rast input=Provinces output=provinces use=attr col=SHP_FID&lt;br /&gt;
&lt;br /&gt;
The relationship between the two raster files can now be explored using a number of statistics commands most of which are found under r.statistics. Perhapsthe most important statistics are r.sum and r.average. &lt;br /&gt;
&lt;br /&gt;
The command&lt;br /&gt;
        r.sum municpalities &lt;br /&gt;
&lt;br /&gt;
will give the total of all the cell values in the municipalities raster. This equals the total population of the region. However what is actually required in the sum of the population for each province. To get this we use r.statistics. Unfortunately this script does not work for floating point rasters (which is what you are most likely to have). To overcome this problem create a new raster reflecting the integer value of each cell. To create a file useable for r.statistics use..&lt;br /&gt;
&lt;br /&gt;
        r.mapcalc&lt;br /&gt;
(then enter line-by-line)&lt;br /&gt;
        int_municpal=round(municipalities)&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
If rounding of the cell values to an integer results in a notable decline in accuracy then create a new raster file in which the values are multiplied by ten or a hundred and only then rounded. In latter analysis recall that the units have been dramatically (but precisely) inflated. To do this try &amp;quot;int_munic=round(100*municipalities)&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
To finally aggregate the municipal population to provinces type... &lt;br /&gt;
&lt;br /&gt;
        r.statistics base=provinces cover=int_municipal method=sum output=prov_pop&lt;br /&gt;
&lt;br /&gt;
This creates a new raster &amp;quot;prov_pop&amp;quot; which can be explored using&lt;br /&gt;
&lt;br /&gt;
d.what.vect&lt;br /&gt;
(click on each region of interest)&lt;br /&gt;
&lt;br /&gt;
You will see that the values for each province now equals the sum of all the cells that fall into that province. If you want to list the values so that you can put them into Provinces.dbf (i.e. the vector) use..&lt;br /&gt;
&lt;br /&gt;
        r.stats input=RSA_STATS -l &lt;br /&gt;
&lt;br /&gt;
The output can then be placed into the corresponding data file using a method similar to that above. &lt;br /&gt;
&lt;br /&gt;
r.statistics comes with a range of other functions other than &amp;quot;sum&amp;quot;. These substantially improve the functionality of the method.  Statistics include distribution, average, mode, median, average deviation, standard deviation, variance, skewness, kurtosis, minimum and maximum. For assistance type &amp;quot;man r.statistics&amp;quot; from the command prompt. Additional functionality is gained by r.mapcalc's ability to perform functions on multiple raster files. This, in itself, makes the move to raster-based mapping most promising.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes the above procedure results in a notable loss in accuracy. There are two main sources for this: &lt;br /&gt;
&lt;br /&gt;
The rounding of cell values (to use r.statistics) may be problematic for areas with very small values. If this is the case consider inflating cell values by one of several orders of magnitude.  &lt;br /&gt;
&lt;br /&gt;
When the region was set up a resolution (E-W and N-S) was specified. If this resolution is not fine enough there may be some loss of accuracy through aggregation. Consider increasing the resolution.&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;/div&gt;</summary>
		<author><name>⚠️Erget</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=Energy_calculations&amp;diff=13547</id>
		<title>Energy calculations</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=Energy_calculations&amp;diff=13547"/>
		<updated>2011-05-29T18:26:03Z</updated>

		<summary type="html">&lt;p&gt;⚠️Erget: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== GRASS and (solar) energy calculations ==&lt;br /&gt;
&lt;br /&gt;
Documents in English:&lt;br /&gt;
* GRASS4LEED: Building geospatial support for Leadership in Environmental and Energy Design. (http://www.foss4g2006.org/contributionDisplay.py?contribId=188&amp;amp;sessionId=40&amp;amp;confId=1)&lt;br /&gt;
* Photovoltaic Geographical Information System (PVGIS, based on r.sun) (http://re.jrc.ec.europa.eu/pvgis/)&lt;br /&gt;
* Solar Lab tutorial http://istgeo.ist.supsi.ch/site/?q=node/3&lt;br /&gt;
* Hofierka, J &amp;amp; Šúri, M, 2002: The solar radiation model for Open source GIS: implementation and applications, Proceedings of the Open source GIS - GRASS users conference 2002 - Trento, Italy, 11-13 September 2002, [http://www.ing.unitn.it/~grass/conferences/GRASS2002/proceedings/proceedings/pdfs/Hofierka_Jaroslav.pdf PDF]&lt;br /&gt;
* Huld, T. A., Šúri, M., Dunlop, E. D., 2003: GIS-based Estimation of Solar Radiation and PV Generation in Central and Eastern Europe on the Web. 9th EC-GI&amp;amp;GIS Workshop, A Coruña (Spain), 25-27 June, [http://re.jrc.ec.europa.eu/pvgis/doc/paper/2003_huld_coruna.pdf PDF]&lt;br /&gt;
* Šúri, M., Huld, T. A., Dunlop, E. D., Hofierka, J. (2007): Solar resource modelling for energy applications.  In: Peckham R.J., Jordan G. (eds.)  Digital Terrain Modelling, Development and Applications in a Policy Support Environment, Series: Lecture Notes in Geoinformation and Cartography, Springer, pp. 259-273, ISBN: 978-3-540-36730-7&lt;br /&gt;
* Hofierka, J. Solar radiation in the Slovak republic, [http://www.fhpv.unipo.sk/kagerr/pracovnici/hofierka/projekty/solar_rad_database.html PDF]&lt;br /&gt;
* Hofierka, J., Kaňuk, J. (2009): Assessment of Photovoltaic Potential in Urban Areas Using Open-Source Solar Radiation Tools. Renewable Energy. In Press.&lt;br /&gt;
* ISIS: International Solar Information Solutions. Solar analyses using GRASS, based largely on the work done for PVGIS (http://www.isi-solutions.org)&lt;br /&gt;
* Search for [http://scholar.google.com/scholar?q=grass+gis+energy GRASS GIS energy] in Google Scholar&lt;br /&gt;
&lt;br /&gt;
Documents in Italian:&lt;br /&gt;
* Mondogis N. 61 (luglio/agosto 2007): Il portale energetico sulle energie rinnovabili per la città di Laives [http://www.r3-gis.com/upload/pages/mondogis-61-2007_laives.pdf PDF] (GRASS, PostGIS)&lt;br /&gt;
* Paolo Zatelli. Valutazione di radiazione solare diretta su falde di tetti inclinati con GRASS. IX Meeting degli Utenti Italiani di GRASS GIS-GFOSS. (http://www.grassmeeting2008.unipg.it/?q=node/9)&lt;br /&gt;
&lt;br /&gt;
Software:&lt;br /&gt;
* GRASS modules {{cmd|r.horizon}} and [[r.sun]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Applications]]&lt;br /&gt;
[[Category: Documentation]]&lt;/div&gt;</summary>
		<author><name>⚠️Erget</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=Contact_Databases&amp;diff=11978</id>
		<title>Contact Databases</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=Contact_Databases&amp;diff=11978"/>
		<updated>2010-10-23T21:44:19Z</updated>

		<summary type="html">&lt;p&gt;⚠️Erget: /* German */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Contact Database=&lt;br /&gt;
&lt;br /&gt;
Here we can collect all contacts where we can send press releases. I will build a webbased formular later. &lt;br /&gt;
The following is ordered by language.&lt;br /&gt;
&lt;br /&gt;
==English==&lt;br /&gt;
*[http://www.slashgeo.org/submit.pl slashgeo] (online)&lt;br /&gt;
*[http://freshmeat.net/projects/grass/?highlight=GRASS Freshmeat] (update: MN)&lt;br /&gt;
*[http://linuxtoday.com/contribute.php3 linuxtoday]&lt;br /&gt;
*[http://www.newsforge.com/submit.pl newsforge]&lt;br /&gt;
*[http://www.macnn.com/contact/newstips/1]  (email to &amp;quot;contact&amp;quot; -&amp;gt; news tips)&lt;br /&gt;
*[http://www10.giscafe.com/submit_material/submit_options.php#Press giscafe]&lt;br /&gt;
*[http://www.directionsmag.com/pressreleases.php directionsmag] (News -&amp;gt; Post Press Release)&lt;br /&gt;
*[http://news.eoportal.org/cgi-bin/eoportal_header.pl?dw=psr&amp;amp;site=software&amp;amp;words=type eoportal] (Share your news with the EO community)&lt;br /&gt;
*[http://gislounge.com/freisin/submits.shtml gislounge]&lt;br /&gt;
*[http://cartographyonline.com] (admin at cartographyonline.com)&lt;br /&gt;
*[http://www.earsc.org/contact EARSC EOMag Newsletter]&lt;br /&gt;
*[http://e-geoinfo.net/index.html GeoinfoNEWS]&lt;br /&gt;
*[http://mycoordinates.org/submit-papers/ Coordinates magazine] India&lt;br /&gt;
*[http://www.osor.eu/ OSOR]&lt;br /&gt;
*[http://www.geoconnexion.com/ GeoConnexion]&lt;br /&gt;
*[http://www.gim-international.com GIM International]&lt;br /&gt;
&lt;br /&gt;
* Meta-Liste at: http://www.giswiki.org/wiki/News&lt;br /&gt;
*[http://freshmeat.net/ freshmeat] (online)&lt;br /&gt;
*[http://freegis.org/ freegis] (online)&lt;br /&gt;
&lt;br /&gt;
==German==&lt;br /&gt;
*[http://www.heise.de heise] (print / online): presse_at_ct.heise.de + [http://www.heise.de/software/download/edit_7105 software]&lt;br /&gt;
*[http://www.harzer.de www.harzer.de] (online): news_at_geobranchen.de&lt;br /&gt;
* Universities:&lt;br /&gt;
** [http://www.gis.uni-kiel.de/index.phtml LearnGIS]: Giszentrum der Universität Kiel&lt;br /&gt;
** [http://www.gis-ma.org gis.ma]: GIS-Lab Marburg (Universität Marburg)&lt;br /&gt;
&lt;br /&gt;
== Italian ==&lt;br /&gt;
&lt;br /&gt;
* MondoGIS / GeoForus.it ([http://www.geoforus.it/index.php?option=com_contact&amp;amp;view=category&amp;amp;catid=2&amp;amp;Itemid=5 contatti])&lt;br /&gt;
* [http://punto-informatico.it/ Punto informatico]&lt;br /&gt;
&lt;br /&gt;
==Other languages==&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Translators=&lt;br /&gt;
Please add yourself here as volunteer to translate GRASS press releases (should be more than one for every language).&lt;br /&gt;
&lt;br /&gt;
==German==&lt;br /&gt;
* Malte Halbey-Martin&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
[[Category:Promotion]]&lt;/div&gt;</summary>
		<author><name>⚠️Erget</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=GRASS_promotion_team&amp;diff=11977</id>
		<title>GRASS promotion team</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=GRASS_promotion_team&amp;diff=11977"/>
		<updated>2010-10-23T21:34:00Z</updated>

		<summary type="html">&lt;p&gt;⚠️Erget: /* People (add yourself here) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=GRASS Promotion=&lt;br /&gt;
Here can the GRASS promotion team coordinate its work.&lt;br /&gt;
&lt;br /&gt;
; Where can we get some resources (financial or support) to print the brochures&lt;br /&gt;
: Ideally you get yourself a corporate sponsor who either does the printing (Autodesk has been very helpful in this respect and they have offices everywhere) or sponsors the printing costs. For example, in Germany you can also directly request for OSGeo funds through [http://www.fossgis.de/ FOSSGIS e.V.], in Italy through [http://www.gfoss.it/ GFOSS.it].  Describe what event you need the brochures for and add an estimate of the printing costs. For larger international events you should contact OSGeo's [http://www.osgeo.org/visibility Marketing Committee], they have a small budget but mostly they can help to coordinate.&lt;br /&gt;
&lt;br /&gt;
= Todo (add yourself) =&lt;br /&gt;
== As soon as possible ==&lt;br /&gt;
1. [[Grassbrochure]] &lt;br /&gt;
*a multipage brochure, maybe something like: [http://www.esri.com/library/brochures/pdfs/avgisbro.pdf Example of the market leader]&lt;br /&gt;
* Maybe same layout as OSGeo brochure, contact with OSGeo [http://www.osgeo.org/visibility Marketing Committee] &lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;strike&amp;gt;[[Promotional material|GRASS Flyer]]&amp;lt;/strike&amp;gt; (done)&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;strike&amp;gt;Technical Data sheet&amp;lt;/strike&amp;gt;&lt;br /&gt;
*Done, 2nd page of flyer&lt;br /&gt;
&lt;br /&gt;
4. Newbie friendly tutorial&lt;br /&gt;
* Update Lorzeno Moretti's &amp;quot;''[http://grass.bologna.enea.it/tutorial/01-tutorial/ Visual Tutorial for GRASS 6]''&amp;quot;?&lt;br /&gt;
* [[GRASS_Help#First_Day_Documentation|First day documentation]]&lt;br /&gt;
&lt;br /&gt;
5. Live CD (maintenance to keep up to date,)&lt;br /&gt;
* OSGeo LiveCD team provides a fancy promo CD: http://download.osgeo.org/livedvd/&lt;br /&gt;
* [http://ldap.telascience.org/foss4g/ FOSS4G2006 Lausanne/Switzerland ''GRASS Workshop LiveCD 2006'']&lt;br /&gt;
* Others: http://grass.osgeo.org/download/cdrom.php&lt;br /&gt;
&lt;br /&gt;
6. Find some funding for printing the flyer / brochure&lt;br /&gt;
&amp;lt;!--* German GRASS user group ([http://www.grass-verein.de GAV e.V.]) offers some funding for flyer--&amp;gt;&lt;br /&gt;
* How much is needed?&lt;br /&gt;
&lt;br /&gt;
''Depends on the quality &amp;amp; number of flyers we want to order''&lt;br /&gt;
''I found one shop where we can get 2500 flyer for about 170 - 270 € (aprox. 225 - 355 US $. depending on paper/colors...)''&lt;br /&gt;
* Find a way to spread the flyer&lt;br /&gt;
&lt;br /&gt;
== Later or synchronous == &lt;br /&gt;
* Translation of the GRASS-Flyer (Latex-file available on the Grass-Addons SVN [http://trac.osgeo.org/grass/browser/grass-promo/grassflyer GRASS-ADDONS-SVN)&lt;br /&gt;
* &amp;lt;strike&amp;gt;Newbie Forum&amp;lt;/strike&amp;gt; (done)&lt;br /&gt;
* [[Contact Databases]]&lt;br /&gt;
* Case Histories of GRASS adoption (?)&lt;br /&gt;
** [[Publications|Publications made with GRASS]]: on this page publications made with GRASS should be listened&lt;br /&gt;
** [[Use Cases|Use Cases successful applications with GRASS]]&lt;br /&gt;
* Nice Posters with applications where GRASS hass been adopted&lt;br /&gt;
* &amp;lt;strike&amp;gt;workaround of [http://www.osgeo.org/grass http://www.osgeo.org/grass]&amp;lt;/strike&amp;gt; ''done''&lt;br /&gt;
* Maybe offer some stuff on coffeepress / spreadshirt&lt;br /&gt;
** for Germany / Europe in progress (thx to Martin Wegmann)&lt;br /&gt;
* Stickers&lt;br /&gt;
* Proofreading&lt;br /&gt;
&lt;br /&gt;
= People (add yourself here) =&lt;br /&gt;
* Malte Halbey-Martin (maltehalbey on irc): email malte [at] geog.fu-berlin.de&lt;br /&gt;
* Ominiverdi (doktoreas or ominoverde on irc) : email info [at] ominiverdi.org&lt;br /&gt;
* Chip Mefford (cpm on irc): email cpm [at] daviswv.net or cpm [at] well.com&lt;br /&gt;
* Carlos Grohmann: email carlos.grohmann [at] gmail.com&lt;br /&gt;
* Milena Nowotarska (milenaN on irc): email do.milenki [at] gmail.com&lt;br /&gt;
* Daniel Lee: email Lee.Daniel.1986 [at] gmail.com&lt;br /&gt;
&lt;br /&gt;
[[Category:Promotion]]&lt;/div&gt;</summary>
		<author><name>⚠️Erget</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=GRASS_promotion_team&amp;diff=11976</id>
		<title>GRASS promotion team</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=GRASS_promotion_team&amp;diff=11976"/>
		<updated>2010-10-23T21:33:05Z</updated>

		<summary type="html">&lt;p&gt;⚠️Erget: /* Later or synchronous */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=GRASS Promotion=&lt;br /&gt;
Here can the GRASS promotion team coordinate its work.&lt;br /&gt;
&lt;br /&gt;
; Where can we get some resources (financial or support) to print the brochures&lt;br /&gt;
: Ideally you get yourself a corporate sponsor who either does the printing (Autodesk has been very helpful in this respect and they have offices everywhere) or sponsors the printing costs. For example, in Germany you can also directly request for OSGeo funds through [http://www.fossgis.de/ FOSSGIS e.V.], in Italy through [http://www.gfoss.it/ GFOSS.it].  Describe what event you need the brochures for and add an estimate of the printing costs. For larger international events you should contact OSGeo's [http://www.osgeo.org/visibility Marketing Committee], they have a small budget but mostly they can help to coordinate.&lt;br /&gt;
&lt;br /&gt;
= Todo (add yourself) =&lt;br /&gt;
== As soon as possible ==&lt;br /&gt;
1. [[Grassbrochure]] &lt;br /&gt;
*a multipage brochure, maybe something like: [http://www.esri.com/library/brochures/pdfs/avgisbro.pdf Example of the market leader]&lt;br /&gt;
* Maybe same layout as OSGeo brochure, contact with OSGeo [http://www.osgeo.org/visibility Marketing Committee] &lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;strike&amp;gt;[[Promotional material|GRASS Flyer]]&amp;lt;/strike&amp;gt; (done)&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;strike&amp;gt;Technical Data sheet&amp;lt;/strike&amp;gt;&lt;br /&gt;
*Done, 2nd page of flyer&lt;br /&gt;
&lt;br /&gt;
4. Newbie friendly tutorial&lt;br /&gt;
* Update Lorzeno Moretti's &amp;quot;''[http://grass.bologna.enea.it/tutorial/01-tutorial/ Visual Tutorial for GRASS 6]''&amp;quot;?&lt;br /&gt;
* [[GRASS_Help#First_Day_Documentation|First day documentation]]&lt;br /&gt;
&lt;br /&gt;
5. Live CD (maintenance to keep up to date,)&lt;br /&gt;
* OSGeo LiveCD team provides a fancy promo CD: http://download.osgeo.org/livedvd/&lt;br /&gt;
* [http://ldap.telascience.org/foss4g/ FOSS4G2006 Lausanne/Switzerland ''GRASS Workshop LiveCD 2006'']&lt;br /&gt;
* Others: http://grass.osgeo.org/download/cdrom.php&lt;br /&gt;
&lt;br /&gt;
6. Find some funding for printing the flyer / brochure&lt;br /&gt;
&amp;lt;!--* German GRASS user group ([http://www.grass-verein.de GAV e.V.]) offers some funding for flyer--&amp;gt;&lt;br /&gt;
* How much is needed?&lt;br /&gt;
&lt;br /&gt;
''Depends on the quality &amp;amp; number of flyers we want to order''&lt;br /&gt;
''I found one shop where we can get 2500 flyer for about 170 - 270 € (aprox. 225 - 355 US $. depending on paper/colors...)''&lt;br /&gt;
* Find a way to spread the flyer&lt;br /&gt;
&lt;br /&gt;
== Later or synchronous == &lt;br /&gt;
* Translation of the GRASS-Flyer (Latex-file available on the Grass-Addons SVN [http://trac.osgeo.org/grass/browser/grass-promo/grassflyer GRASS-ADDONS-SVN)&lt;br /&gt;
* &amp;lt;strike&amp;gt;Newbie Forum&amp;lt;/strike&amp;gt; (done)&lt;br /&gt;
* [[Contact Databases]]&lt;br /&gt;
* Case Histories of GRASS adoption (?)&lt;br /&gt;
** [[Publications|Publications made with GRASS]]: on this page publications made with GRASS should be listened&lt;br /&gt;
** [[Use Cases|Use Cases successful applications with GRASS]]&lt;br /&gt;
* Nice Posters with applications where GRASS hass been adopted&lt;br /&gt;
* &amp;lt;strike&amp;gt;workaround of [http://www.osgeo.org/grass http://www.osgeo.org/grass]&amp;lt;/strike&amp;gt; ''done''&lt;br /&gt;
* Maybe offer some stuff on coffeepress / spreadshirt&lt;br /&gt;
** for Germany / Europe in progress (thx to Martin Wegmann)&lt;br /&gt;
* Stickers&lt;br /&gt;
* Proofreading&lt;br /&gt;
&lt;br /&gt;
= People (add yourself here) =&lt;br /&gt;
* Malte Halbey-Martin (maltehalbey on irc): email malte [at] geog.fu-berlin.de&lt;br /&gt;
* Ominiverdi ( doktoreas or ominoverde on irc ) : email info [at] ominiverdi.org&lt;br /&gt;
* Chip Mefford (cpm on irc) : email cpm [at] daviswv.net or cpm [at] well.com&lt;br /&gt;
* Carlos Grohmann: email carlos.grohmann [at] gmail.com&lt;br /&gt;
* Milena Nowotarska (milenaN on irc) : email do.milenki [at] gmail.com&lt;br /&gt;
&lt;br /&gt;
[[Category:Promotion]]&lt;/div&gt;</summary>
		<author><name>⚠️Erget</name></author>
	</entry>
</feed>