~grass/grass/releasebranch_7_0

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<h2>DESCRIPTION</h2>

<em>r.external</em> allows a user to link a GDAL supported raster file to a binary
raster map layer, from any GDAL supported raster map format, with an optional 
title. The file is not imported but just registered as GRASS raster map.

<h2>NOTES</h2>

In essence, <em>r.external</em> creates a read-only link to the 
original dataset which is only valid if the original dataset remains 
at the originally indicated directory and filename.

<h2>NULL data handling</h2>

GDAL-linked (<em>r.external</em>) maps do not have or use a NULL 
bitmap, hence <em>r.null</em> cannot manipulate them directly. Here 
NULL cells are those whose value matches the value reported by the 
GDALGetRasterNoDataValue() function.

To apply the GDAL-linked the user need to either create a MASK (e.g. 
with <em>r.mask</em>) and then "apply" it using e.g. <em>r.resample</em>,
or use <em>r.mapcalc</em> to create a copy with the appropriate categories
changed to NULL (if() condition).

<h2>EXAMPLES</h2>

<h3>RGB Orthophoto from GeoTIFF</h3>

<div class="code"><pre>
# import of all channels (each channel will become a GRASS raster map):
r.external input=/home/user/data/maps/059100.tif output=ortho
g.region raster=ortho.3 -p
d.rgb r=ortho.1 g=ortho.2 b=ortho.3
r.composite r=ortho.1 g=ortho.2 b=ortho.3 output=ortho.rgb
</pre></div>

<h3>Processing workflow without data import and export</h3>

External raster maps to be processed can be directly linked using <em>r.external</em>;
likewise, results can be written out to standard raster formats with
<em>r.external.out</em> (GDAL supported formats):

<div class="code"><pre>
# register GeoTIFF file to be used in current mapset:
r.external input=terra_lst1km20030314.LST_Day.tif output=modis_celsius
 
# define output directory for files resulting from GRASS calculation:
r.external.out directory=$HOME/gisoutput/ format="GTiff"

# perform GRASS calculation (here: extract pixels &gt; 20 deg C)
# this stores the output map directly as GeoTIFF:
r.mapcalc "warm.tif = if(modis_celsius &gt; 20.0, modis_celsius, null() )"

# cease GDAL output connection and turn back to write GRASS raster files:
r.external.out -r

# now use the resulting file elsewhere
gdalinfo $HOME/gisoutput/warm.tif
</pre></div>

<h2>REFERENCES</h2>

GDAL Pages: <a href="http://www.gdal.org">http://www.gdal.org/</a><br>

<h2>SEE ALSO</h2>

<em>
<a href="r.import.html">r.import</a>,
<a href="r.in.gdal.html">r.in.gdal</a>,
<a href="r.external.out.html">r.external.out</a>
</em>

<p>
<em>
<a href="v.import.html">v.import</a>,
<a href="v.in.ogr.html">v.in.ogr</a>,
<a href="v.external.html">v.external</a>,
<a href="v.external.out.html">v.external.out</a>
</em>

<h2>AUTHOR</h2>

Glynn Clements

<p>
<i>Last changed: $Date$</i>