Description Usage Arguments Details Author(s) See Also Examples
Converts a "SpatialGridDataFrame"
object to a polygon map with each available grid node represented with a polygon. To allow further export to KML, grid2poly
will, by default, convert any projected coordinates to the lat-lon system (geographic coordinates in the WGS84 system).
1 2 3 |
obj |
|
var.name |
target variable column name |
reproject |
logical; reproject coordinates to lat lon system? |
method |
decide to convert grids to polygons either using |
tmp.file |
logical; specify whether to create a temporary file, or to actually write to the workding directory (in the case of SAGA GIS is used to convert grids) |
saga_lib |
string; SAGA GIS library name |
saga_module |
SAGA GIS module number; see |
silent |
logical; specifies whether to print the SAGA GIS output |
... |
additional arguments that can be parsed to the |
grid2poly
is not recommended for large grids (>>10e4 pixels). Consider splitting large input grids into tiles before running grid2poly
. For converting large grids to polygons consider using SAGA GIS (method = "RSAGA"
) instead of using the default sp method.
Tomislav Hengl
vect2rast
, raster::rasterToPolygons
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | data(eberg_grid)
library(sp)
coordinates(eberg_grid) <- ~x+y
gridded(eberg_grid) <- TRUE
proj4string(eberg_grid) <- CRS("+init=epsg:31467")
data(SAGA_pal)
## Not run: # compare various methods:
system.time(dem_poly <- grid2poly(eberg_grid, "DEMSRT6", method = "raster"))
system.time(dem_poly <- grid2poly(eberg_grid, "DEMSRT6", method = "sp"))
system.time(dem_poly <- grid2poly(eberg_grid, "DEMSRT6", method = "RSAGA"))
## plotting large polygons in R -> not a good idea
# spplot(dem_poly, col.regions = SAGA_pal[[1]])
## visualize the data in Google Earth:
kml(dem_poly, colour_scale = SAGA_pal[[1]], colour = DEMSRT6, kmz = TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.