Converts a raster to points, with optional rescaling (combines aggregate and rasterToPoints from package "raster").

Share:

Description

Converts a raster to points, with optional rescaling (combines aggregate and rasterToPoints from package "raster").

Usage

1
2
3
  rasterToPointsWithScaling(x, fact = 2, fun = mean,
    expand = TRUE, na.rm = TRUE, filename = "",
    subset_fun = NULL, spatial = FALSE, ...)

Arguments

x

A Raster* object

fact

Integer. Aggregation factor expressed as number of cells in each direction (horizontally and vertically). Or two integers (horizontal and vertical aggregation factor). Default is 2.

fun

Function used to aggregate values (default=mean).

expand

Logical. If TRUE the output RasterLayer will be larger then the input RasterLayer if a division of the number of columns or rows with factor is not an integer.

na.rm

logical. If TRUE, NA cells are removed from calculations.

filename

Character. Output filename.

subset_fun

Function to select a subset of raster values.

spatial

Logical. If TRUE, the function returns a SpatialPointsDataFrame object.

...

Additional arguments.

Author(s)

Jonathan A. Greenberg STARStools@estarcion.net and Robert Hijimans

See Also

rasterToPoints

Examples

1
2
3
tahoe_lidar_bareearth <- raster(system.file("external/tahoe_lidar_bareearth.tif", package="STARStools"))
tahoe_lidar_bareearth_points=rasterToPointsWithScaling(tahoe_lidar_bareearth,fact=8,spatial=TRUE)
spplot(tahoe_lidar_bareearth_points)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.