Description Usage Arguments Details Value Author(s) References See Also Examples
import.asc
imports ESRI ArcInfo ASCII raster file ; conversely,
export.asc
allows to export an asc object to a ESRI ArcInfo ASCII
raster file.
1 2 3 4 5 6 7 |
file |
a character string. The name of an Arcview ASCII Raster file |
type |
a character string. Either |
lev |
if |
levnb |
if |
labnb |
if |
x |
a matrix of class |
xll |
the x coordinate of the center of the lower left pixel of the map |
yll |
the y coordinate of the center of the lower left pixel of the map |
cellsize |
the size of a pixel on the studied map |
... |
additionnal arguments to be passed to the function
|
With Arcview 3.x: ASCII raster files are created using the command
"File -> Export data source"
With Arcview 8/9: ASCII raster files are created by the command
"Arc Toolbox -> Conversion tools -> From raster -> Raster to
ASCII"
.
With GRASS, the best way to import a raster map within R is to use the
package spgrass6
, and then to use the function
spixdf2kasc
to convert the files to format that can be managed
by adehabitat.
ASCII raster files may also be created using other free programs, such
as landserf (http://www.soi.city.ac.uk/~jwo/landserf/).
Raster maps are stored as matrices of class asc
with
adehabitat. They may be of type "numeric"
(e.g. elevation on an
area) or "factor"
(e.g. the type of vegetation on an area). If
the map is of type factor
, the levels should be indicated. The
".asc"
files store the values of the mapped variable with
numeric values. Each level of the factor is coded on the map by a
number. The argument lev
of import.asc
or as.asc
gives the labels corresponding to each number. Alternatively, these
levels may be specified using a correspondence table exported from
Arcview (with this software, command "Theme -> table"
, then
"File -> Export"
, and finally export in delimited text
format). An example of such file is provided in the directory
"ascfiles" of the package, see the examples below. export.asc
allows only exportation of numeric maps.
Returns a raster matrix of the class asc
, with the following
attributes :
xll |
the x coordinate of the center of the lower left pixel of the map |
yll |
the y coordinate of the center of the lower left pixel of the map |
cellsize |
the size of a pixel on the studied map |
type |
either |
levels |
if |
Clement Calenge clement.calenge@oncfs.gouv.fr
Arcview: http://www.esri.com
Landserf: http://www.soi.city.ac.uk/~jwo/landserf/
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 | ## Not run:
## Importation of asc files: numeric
## Path of the file to be imported
(file1 <- paste(system.file(package = "adehabitat"),
"ascfiles/elevation.asc", sep = "/"))
el <- import.asc(file1)
image(el)
el
## Importation of asc files: factor
(file2 <- paste(system.file(package = "adehabitat"),
"ascfiles/aspect.asc", sep = "/"))
(levelfile <- paste(system.file(package = "adehabitat"),
"ascfiles/aspect.txt", sep = "/"))
asp <- import.asc(file2, lev = levelfile, type = "factor")
image(asp)
asp
## map of white noise
wafwaf <- matrix(rnorm(10000), 100, 100)
wafwaf <- as.asc(wafwaf)
image(wafwaf)
## exportation of a map
export.asc(wafwaf, "foo.asc")
## remove the created file:
file.remove("foo.asc")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.