r.import(1)

NAME
r.import - Imports raster data into a GRASS raster map using GDAL library and reprojects on the fly.

KEYWORDS
raster, import, projection

SYNOPSIS
r.import
r.import --help
r.import [-enlo] input=name [band=integer[,integer,...]] [memory=integer] [output=name] [resample=string] [extent=string] [resolution=string] [resolution_value=float] [title=phrase] [--overwrite] [--help] [--verbose] [--quiet] [--ui]

  Flags:

-e
    Estimate resolution only

-n
    Do not perform region cropping optimization

-l
    Force Lat/Lon maps to fit into geographic coordinates (90N,S; 180E,W)

-o
    Override projection check (use current location’s projection)
    Assume that the dataset has the same projection as the current location

--overwrite
    Allow output files to overwrite existing files

--help
    Print usage summary

--verbose
    Verbose module output

--quiet
    Quiet module output

--ui
    Force launching GUI dialog

  Parameters:

input=name [required]
    Name of GDAL dataset to be imported

band=integer[,integer,...]
    Input band(s) to select (default is all bands)

memory=integer
    Maximum memory to be used (in MB)
    Cache size for raster rows
    Default: 300

output=name
    Name for output raster map

resample=string
    Resampling method to use for reprojection
    Options: nearest, bilinear, bicubic, lanczos, bilinear_f, bicubic_f, lanczos_f
    Default: nearest
    nearest: nearest neighbor
    bilinear: bilinear interpolation
    bicubic: bicubic interpolation
    lanczos: lanczos filter
    bilinear_f: bilinear interpolation with fallback
    bicubic_f: bicubic interpolation with fallback
    lanczos_f: lanczos filter with fallback

extent=string
    Output raster map extent
    Options: input, region
    Default: input
    input: extent of input map
    region: extent of current region

resolution=string
    Resolution of output raster map (default: estimated)
    Options: estimated, value, region
    Default: estimated
    estimated: estimated resolution
    value: user-specified resolution
    region: current region resolution

resolution_value=float
    Resolution of output raster map (use with option resolution=value)

title=phrase
    Title for resultant raster map

DESCRIPTION
r.import imports a map or selected bands from a GDAL raster datasource into the current location and mapset. If the projection of the input does not match the projection of the location, the input is reprojected into the current location. If the projection of the input does match the projection of the location, the input is imported directly with r.in.gdal.

NOTES
r.import checks the projection metadata of the dataset to be imported against the current location’s projection. If not identical a related error message is shown.
To override this projection check (i.e. to use current location’s projection) by assuming that the dataset has the same projection as the current location the -o flag can be used. This is also useful when geodata to be imported do not contain any projection metadata at all. The user must be sure that the projection is identical in order to avoid to introduce data errors.

  Resolution
r.import 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 resolution is set to estimated (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 -e can be used first to obtain the estimate without importing the raster bands. Then the desired resolution is set with option resolution_value and option resolution=value. For latlong locations, the resolution might be set to arc seconds, e.g. 1, 3, 7.5, 15, and 30 arc seconds are commonly used resolutions.

  Resampling methods
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 iterpolation or lanczos.

In the following common use cases:

nearest is the simplest method and the only possible method for categorical data.

bilinear does linear interpolation and provides smoother output than nearest. bilinear is recommended when reprojecting a DEM for hydrological analysis or for surfaces where overshoots must be avoided, e.g. precipitation should not become negative.

bicubic produces smoother output than bilinear, at the cost of overshoots.

lanczos produces the smoothest output of all methods and preserves contrast best. lanczos is recommended for imagery. Both bicubic and lanczos preserve linear features. With nearest or bilinear, linear features can become zigzag features after reprojection.

For explanation of the -l flag, please refer to the r.in.gdal manual.

When importing whole-world maps the user should disable map-trimming with the -n flag. For further explanations of -n flag, please refer the to r.proj manual.

EXAMPLES

  Import of SRTM V3 global data at 1 arc-seconds resolution
The SRTM V3 1 arc-second global data (~30 meters resolution) are available from EarthExplorer (http://earthexplorer.usgs.gov/). The SRTM collections are located under the "Digital Elevation" category.

Example for North Carolina sample dataset (the tile name is "n35_w079_1arc_v3.tif"):

# 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

  Import of WorldClim data
Import of a subset from WorldClim Bioclim data set, to be reprojected to current location projection (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 extent parameter:

# 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 location projection,
# 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

SEE ALSO
r.in.gdal, r.proj

AUTHORS
Markus Metz
Improvements: Martin Landa, Anna Petrasova

Last changed: $Date$

SOURCE CODE

Available at: r.import source code (history)

Main index | Raster index | Topics index | Keywords index | Graphical index | Full index

© 2003-2019 GRASS Development Team, GRASS GIS 7.8.0 Reference Manual