-
-
Notifications
You must be signed in to change notification settings - Fork 295
/
r.import.html
149 lines (124 loc) · 6.18 KB
/
r.import.html
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<h2>DESCRIPTION</h2>
<em>r.import</em> imports a map or selected bands from a GDAL raster datasource
into the current project (previously called location) and mapset.
If the coordinate reference system (CRS) of the input
does not match the CRS of the project, the input is reprojected
into the current project. If the CRS of the input does match
the CRS of the project, the input is imported directly with
<a href="r.in.gdal.html">r.in.gdal</a>.
<h2>NOTES</h2>
<em>r.import</em> checks the CRS metadata of the dataset to be
imported against the current project's CRS. If not identical a
related error message is shown.
<br>
To override this projection check (i.e. to use current project's CRS)
by assuming that the dataset has the same CRS as the current project
the <b>-o</b> flag can be used. This is also useful when geodata to be
imported do not contain any CRS metadata at all. The user must be
sure that the CRS is identical in order to avoid introducing data
errors.
<h3>Resolution</h3>
<em>r.import</em> reports the estimated target resolution for each
input band. The estimated resolution will usually be some floating
point number, e.g. 271.301. In case option <b>resolution</b> is set to
<em>estimated</em> (default), this floating point number will be used
as target resolution. Since the target resolution should be typically the rounded
estimated resolution, e.g. 250 or 300 instead of 271.301, flag <b>-e</b>
can be used first to obtain the estimate without importing the raster bands.
Then the desired resolution is set with option <b>resolution_value</b>
and option <b>resolution</b>=<em>value</em>.
For latlong projects, the resolution might be set to arc seconds, e.g. 1, 3, 7.5,
15, and 30 arc seconds are commonly used resolutions.
<h3>Resampling methods</h3>
When reprojecting a map to a new spatial reference system, the projected
data is resampled with one of four different methods: nearest neighbor,
bilinear, bicubic interpolation or lanczos.
<p>
In the following, common use cases are:
<p>
<b>nearest</b> is the simplest method and the only possible method for
categorical data.
<p>
<b>bilinear</b> does linear interpolation and provides smoother output
than <b>nearest</b>. <b>bilinear</b> is recommended when reprojecting a
DEM for hydrological analysis or for surfaces where overshoots must be
avoided, e.g. precipitation should not become negative.
<p>
<b>bicubic</b> produces smoother output than <b>bilinear</b>, at
the cost of overshoots. Here, valid pixels that are adjacent to NULL pixels
or edge pixels are set to NULL.
<p>
<b>lanczos</b> produces the smoothest output of all methods and
preserves contrast best. <b>lanczos</b> is recommended for imagery.
Both <b>bicubic</b> and <b>lanczos</b> preserve linear features. With
<b>nearest</b> or <b>bilinear</b>, linear features can become zigzag
features after reprojection.
<p>
In the bilinear, bicubic and lanczos methods, if any of the surrounding
cells used to interpolate the new cell value are NULL, the resulting
cell will be NULL, even if the nearest cell is not NULL. This will
cause some thinning along NULL borders, such as the coasts of land
areas in a DEM. The bilinear_f, bicubic_f and lanczos_f interpolation
methods can be used if thinning along NULL edges is not desired.
These methods "fall back" to simpler interpolation methods
along NULL borders. That is, from lanczos to bicubic to bilinear to
nearest.
<p>
For explanation of the <b>-l</b> flag, please refer to the
<a href="r.in.gdal.html">r.in.gdal</a> manual.
<p>
When importing whole-world maps the user should disable map-trimming with
the <b>-n</b> flag. For further explanations of <b>-n</b> flag, please refer
the to <a href="r.proj.html">r.proj</a> manual.
<h2>EXAMPLES</h2>
<h3>Import of SRTM V3 global data at 1 arc-seconds resolution</h3>
The SRTM V3 1 arc-second global data (~30 meters resolution) are available
from EarthExplorer (<a href="http://earthexplorer.usgs.gov/">http://earthexplorer.usgs.gov/</a>).
The SRTM collections are located under the "Digital Elevation" category.
<p>
Example for North Carolina sample dataset (the tile name is "n35_w079_1arc_v3.tif"):
<div class="code"><pre>
# set computational region to e.g. 10m elevation model:
g.region raster=elevation -p
# Import with reprojection on the fly. Recommended parameters:
# resample Resampling method to use for reprojection - bilinear
# extent Output raster map extent - region: extent of current region
# resolution Resolution of output raster map
# - region: current region resolution - limit to g.region setting from above
r.import input=n35_w079_1arc_v3.tif output=srtmv3_resamp10m resample=bilinear \
extent=region resolution=region title="SRTM V3 resampled to 10m resolution"
# beautify colors:
r.colors srtmv3_resamp10m color=elevation
</pre></div>
<h3>Import of WorldClim data</h3>
Import of a subset from WorldClim <a href="http://worldclim.org/bioclim">Bioclim data set</a>,
to be reprojected to current project CRS (North Carolina sample dataset).
Different resolutions are available, in this example we use the 2.5 arc-minutes
resolution data. During import, we spatially subset the world data to the
North Carolina region using the <em>extent</em> parameter:
<div class="code"><pre>
# download selected Bioclim data (2.5 arc-minutes resolution)
# optionally tiles are available for the 30 arc-sec resolution
wget http://biogeo.ucdavis.edu/data/climate/worldclim/1_4/grid/cur/bio_2-5m_bil.zip
# extract BIO1 from package (BIO1 = Annual Mean Temperature):
unzip bio_2-5m_bil.zip bio1.bil bio1.hdr
# prior to import, fix broken WorldClim extent using GDAL tool
gdal_translate -a_ullr -180 90 180 -60 bio1.bil bio1_fixed.tif
# set computational region to North Carolina, 4000 m target pixel resolution
g.region -d res=4000 -ap
# subset to current region and reproject on the fly to current project CRS,
# using -n since whole-world map is imported:
r.import input=bio1_fixed.tif output=bioclim01 resample=bilinear \
extent=region resolution=region -n
# temperature data are in °C * 10
r.info bioclim01
r.univar -e bioclim01
</pre></div>
<h2>SEE ALSO</h2>
<em>
<a href="r.in.gdal.html">r.in.gdal</a>,
<a href="r.proj.html">r.proj</a>
</em>
<h2>AUTHORS</h2>
Markus Metz<br>
Improvements: Martin Landa, Anna Petrasova