r.import.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <h2>DESCRIPTION</h2>
  2. <em>r.import</em> imports a map or selected bands from a GDAL raster datasource
  3. into the current location and mapset. If the projection of the input
  4. does not match the projection of the location, the input is reprojected
  5. into the current location. If the projection of the input does match
  6. the projection of the location, the input is imported directly with
  7. <a href="r.in.gdal.html">r.in.gdal</a>.
  8. <h2>NOTES</h2>
  9. <em>r.import</em> checks the projection metadata of the dataset to be
  10. imported against the current location's projection. If not identical a
  11. related error message is shown.
  12. <br>
  13. To override this projection check (i.e. to use current location's projection)
  14. by assuming that the dataset has the same projection as the current location
  15. the <b>-o</b> flag can be used. This is also useful when geodata to be
  16. imported do not contain any projection metadata at all. The user must be
  17. sure that the projection is identical in order to avoid to introduce data
  18. errors.
  19. <h3>Resolution</h3>
  20. <em>r.import</em> reports the estimated target resolution for each
  21. input band. The estimated resolution will usually be some floating
  22. point number, e.g. 271.301. In case option <b>resolution</b> is set to
  23. <em>estimated</em> (default), this floating point number will be used
  24. as target resolution. Since the target resolution should be typically the rounded
  25. estimated resolution, e.g. 250 or 300 instead of 271.301, flag <b>-e</b>
  26. can be used first to obtain the estimate without importing the raster bands.
  27. Then the desired resolution is set with option <b>resolution_value</b>
  28. and option <b>resolution</b>=<em>value</em>.
  29. For latlong locations, the resolution might be set to arc seconds, e.g. 1, 3, 7.5,
  30. 15, and 30 arc seconds are commonly used resolutions.
  31. <h3>Resampling methods</h3>
  32. When reprojecting a map to a new spatial reference system, the projected
  33. data is resampled with one of four different methods: nearest neighbor,
  34. bilinear, bicubic interpolation or lanczos.
  35. <p>
  36. In the following, common use cases are:
  37. <p>
  38. <b>nearest</b> is the simplest method and the only possible method for
  39. categorical data.
  40. <p>
  41. <b>bilinear</b> does linear interpolation and provides smoother output
  42. than <b>nearest</b>. <b>bilinear</b> is recommended when reprojecting a
  43. DEM for hydrological analysis or for surfaces where overshoots must be
  44. avoided, e.g. precipitation should not become negative.
  45. <p>
  46. <b>bicubic</b> produces smoother output than <b>bilinear</b>, at
  47. the cost of overshoots. Here, valid pixels that are adjacent to NULL pixels
  48. or edge pixels are set to NULL.
  49. <p>
  50. <b>lanczos</b> produces the smoothest output of all methods and
  51. preserves contrast best. <b>lanczos</b> is recommended for imagery.
  52. Both <b>bicubic</b> and <b>lanczos</b> preserve linear features. With
  53. <b>nearest</b> or <b>bilinear</b>, linear features can become zigzag
  54. features after reprojection.
  55. <p>
  56. In the bilinear, bicubic and lanczos methods, if any of the surrounding
  57. cells used to interpolate the new cell value are NULL, the resulting
  58. cell will be NULL, even if the nearest cell is not NULL. This will
  59. cause some thinning along NULL borders, such as the coasts of land
  60. areas in a DEM. The bilinear_f, bicubic_f and lanczos_f interpolation
  61. methods can be used if thinning along NULL edges is not desired.
  62. These methods &quot;fall back&quot; to simpler interpolation methods
  63. along NULL borders. That is, from lanczos to bicubic to bilinear to
  64. nearest.
  65. <p>
  66. For explanation of the <b>-l</b> flag, please refer to the
  67. <a href="r.in.gdal.html">r.in.gdal</a> manual.
  68. <p>
  69. When importing whole-world maps the user should disable map-trimming with
  70. the <b>-n</b> flag. For further explanations of <b>-n</b> flag, please refer
  71. the to <a href="r.proj.html">r.proj</a> manual.
  72. <h2>EXAMPLES</h2>
  73. <h3>Import of SRTM V3 global data at 1 arc-seconds resolution</h3>
  74. The SRTM V3 1 arc-second global data (~30 meters resolution) are available
  75. from EarthExplorer (<a href="http://earthexplorer.usgs.gov/">http://earthexplorer.usgs.gov/</a>).
  76. The SRTM collections are located under the "Digital Elevation" category.
  77. <p>
  78. Example for North Carolina sample dataset (the tile name is "n35_w079_1arc_v3.tif"):
  79. <div class="code"><pre>
  80. # set computational region to e.g. 10m elevation model:
  81. g.region raster=elevation -p
  82. # Import with reprojection on the fly. Recommended parameters:
  83. # resample Resampling method to use for reprojection - bilinear
  84. # extent Output raster map extent - region: extent of current region
  85. # resolution Resolution of output raster map
  86. # - region: current region resolution - limit to g.region setting from above
  87. r.import input=n35_w079_1arc_v3.tif output=srtmv3_resamp10m resample=bilinear \
  88. extent=region resolution=region title="SRTM V3 resampled to 10m resolution"
  89. # beautify colors:
  90. r.colors srtmv3_resamp10m color=elevation
  91. </pre></div>
  92. <h3>Import of WorldClim data</h3>
  93. Import of a subset from WorldClim <a href="http://worldclim.org/bioclim">Bioclim data set</a>,
  94. to be reprojected to current location projection (North Carolina sample dataset).
  95. Different resolutions are available, in this example we use the 2.5 arc-minutes
  96. resolution data. During import, we spatially subset the world data to the
  97. North Carolina region using the <em>extent</em> parameter:
  98. <div class="code"><pre>
  99. # download selected Bioclim data (2.5 arc-minutes resolution)
  100. # optionally tiles are available for the 30 arc-sec resolution
  101. wget http://biogeo.ucdavis.edu/data/climate/worldclim/1_4/grid/cur/bio_2-5m_bil.zip
  102. # extract BIO1 from package (BIO1 = Annual Mean Temperature):
  103. unzip bio_2-5m_bil.zip bio1.bil bio1.hdr
  104. # prior to import, fix broken WorldClim extent using GDAL tool
  105. gdal_translate -a_ullr -180 90 180 -60 bio1.bil bio1_fixed.tif
  106. # set computational region to North Carolina, 4000 m target pixel resolution
  107. g.region -d res=4000 -ap
  108. # subset to current region and reproject on the fly to current location projection,
  109. # using -n since whole-world map is imported:
  110. r.import input=bio1_fixed.tif output=bioclim01 resample=bilinear \
  111. extent=region resolution=region -n
  112. # temperature data are in &deg;C * 10
  113. r.info bioclim01
  114. r.univar -e bioclim01
  115. </pre></div>
  116. <h2>SEE ALSO</h2>
  117. <em>
  118. <a href="r.in.gdal.html">r.in.gdal</a>,
  119. <a href="r.proj.html">r.proj</a>
  120. </em>
  121. <h2>AUTHORS</h2>
  122. Markus Metz<br>
  123. Improvements: Martin Landa, Anna Petrasova
  124. <!--
  125. <p>
  126. <i>Last changed: $Date$</i>
  127. -->