arcgisbinding (version 1.0.1.229)

arc.raster-class: Reference Class "arc.raster"

Description

TODO

Arguments

Fields

sr

Get or set Spacial Reference

extent

Get or set extent. Uset it to read portion of raster.

nrow

Get or set number of row.

ncol

Get or set number of column.

cellsize

Get pixel size.

pixel_type

Get or set pixel type.

pixel_depth

Get pixel depth

nodata

Get or set nodata value

resample_type

Get or set resampling type.

colormap

Get or set color map table. Return is a vector of 256 colors in the RGB format.

bands

Get raster band information

Methods

names

dim

arc.write

$save_as(path, opt)

$commit(opt)

End writing. opt - aditional parameter (default: build-stats)

$pixel_block(ul_x, ul_y, nrow, ncol, bands)

Read pixel values. ul_x, ul_y - upper left corner in pixels nrow, ncol - size in pixels

$write_pixel_block(values, ul_x, ul_y, ncol, nrow)

Write pixel values.

$attribute_table()

Query raster attribute table

Examples

Run this code
# NOT RUN {
## read 5x5 pixel block with 10,10 offset
r.file <- system.file("pictures", "cea.tif", package="rgdal")
r <- arc.raster(arc.open(r.file))
v <- r$pixel_block(ul_x = 10L, ul_y = 10L, nrow = 5L, ncol= 5L)
stopifnot(length(v) == 25)

## process big raster
r2 = arc.raster(NULL, path=tempfile("r2", fileext=".img"),
                dim=dim(r), pixel_type=r$pixel_type, nodata=r$nodata,
                extent=r$extent,sr=r$sr)
for (i in 1L:r$nrow)
{
  v <- r$pixel_block(ul_y = i - 1L, nrow = 1L)
  r2$write_pixel_block(v * 1.5, ul_y = i - 1L, nrow = 1L, ncol = r$ncol)
}
r2$commit()

## resample raster
r <- arc.raster(arc.open(r.file), nrow=200L, ncol=200L, resample_type="BilinearGaussBlur")

## save to a different format
r$save_as(tempfile("new_raster", fileext=".img"))

## get and compare all pixel values
r.file <- system.file("pictures", "logo.jpg", package="rgdal")
rx <- raster::brick(r.file)
r <- arc.raster(arc.open(r.file))
stopifnot(all(raster::values(rx) == r$pixel_block()))

# }

Run the code above in your browser using DataLab