File: r.external.html

package info (click to toggle)
grass 8.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 277,040 kB
  • sloc: ansic: 460,798; python: 227,732; cpp: 42,026; sh: 11,262; makefile: 7,007; xml: 3,637; sql: 968; lex: 520; javascript: 484; yacc: 450; asm: 387; perl: 157; sed: 25; objc: 6; ruby: 4
file content (83 lines) | stat: -rw-r--r-- 2,707 bytes parent folder | download | duplicates (2)
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
<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="https://gdal.org">https://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