r.external.html 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <h2>DESCRIPTION</h2>
  2. <em>r.external</em> allows a user to link a GDAL supported raster file to a binary
  3. raster map layer, from any GDAL supported raster map format, with an optional
  4. title. The file is not imported but just registered as GRASS raster map.
  5. <h2>NOTES</h2>
  6. In essence, <em>r.external</em> creates a read-only link to the
  7. original dataset which is only valid if the original dataset remains
  8. at the originally indicated directory and filename.
  9. <h2>NULL data handling</h2>
  10. GDAL-linked (<em>r.external</em>) maps do not have or use a NULL
  11. bitmap, hence <em>r.null</em> cannot manipulate them directly. Here
  12. NULL cells are those whose value matches the value reported by the
  13. GDALGetRasterNoDataValue() function.
  14. To apply the GDAL-linked the user need to either create a MASK (e.g.
  15. with <em>r.mask</em>) and then "apply" it using e.g. <em>r.resample</em>,
  16. or use <em>r.mapcalc</em> to create a copy with the appropriate categories
  17. changed to NULL (if() condition).
  18. <h2>EXAMPLES</h2>
  19. <h3>RGB Orthophoto from GeoTIFF</h3>
  20. <div class="code"><pre>
  21. # import of all channels (each channel will become a GRASS raster map):
  22. r.external input=/home/user/data/maps/059100.tif output=ortho
  23. g.region raster=ortho.3 -p
  24. d.rgb r=ortho.1 g=ortho.2 b=ortho.3
  25. r.composite r=ortho.1 g=ortho.2 b=ortho.3 output=ortho.rgb
  26. </pre></div>
  27. <h3>Processing workflow without data import and export</h3>
  28. External raster maps to be processed can be directly linked using <em>r.external</em>;
  29. likewise, results can be written out to standard raster formats with
  30. <em>r.external.out</em> (GDAL supported formats):
  31. <div class="code"><pre>
  32. # register GeoTIFF file to be used in current mapset:
  33. r.external input=terra_lst1km20030314.LST_Day.tif output=modis_celsius
  34. # define output directory for files resulting from GRASS calculation:
  35. r.external.out directory=$HOME/gisoutput/ format="GTiff"
  36. # perform GRASS calculation (here: extract pixels &gt; 20 deg C)
  37. # this stores the output map directly as GeoTIFF:
  38. r.mapcalc "warm.tif = if(modis_celsius &gt; 20.0, modis_celsius, null() )"
  39. # cease GDAL output connection and turn back to write GRASS raster files:
  40. r.external.out -r
  41. # now use the resulting file elsewhere
  42. gdalinfo $HOME/gisoutput/warm.tif
  43. </pre></div>
  44. <h2>REFERENCES</h2>
  45. GDAL Pages: <a href="http://www.gdal.org">http://www.gdal.org/</a><br>
  46. <h2>SEE ALSO</h2>
  47. <em>
  48. <a href="r.import.html">r.import</a>,
  49. <a href="r.in.gdal.html">r.in.gdal</a>,
  50. <a href="r.external.out.html">r.external.out</a>
  51. </em>
  52. <p>
  53. <em>
  54. <a href="v.import.html">v.import</a>,
  55. <a href="v.in.ogr.html">v.in.ogr</a>,
  56. <a href="v.external.html">v.external</a>,
  57. <a href="v.external.out.html">v.external.out</a>
  58. </em>
  59. <h2>AUTHOR</h2>
  60. Glynn Clements
  61. <p>
  62. <i>Last changed: $Date$</i>