Description Usage Arguments Details Value Note Author(s) References See Also Examples
View source: R/Grid2Polygons.R
This function has been deprecated; please use inlmisc::Grid2Polygons
instead.
Used to convert sp spatial objects from class 'SpatialGridDataFrame
' to 'SpatialPolygonsDataFrame
'.
Spatial polygons can then be transformed to a different projection or datum with spTransform
in package rgdal.
Image files created with spatial polygons are reduced in size and result in a much "cleaner" version of your image.
1 2 |
grd |
SpatialGridDataFrame. Spatial grid data frame |
zcol |
character or integer. Attribute name or column number in attribute table. |
level |
logical.
If true, a set of levels is used to partition the range of |
at |
numeric.
A vector giving breakpoints along the range of |
cuts |
integer.
Number of levels the range of |
pretty |
logical. Whether to use pretty cut locations. |
xlim |
numeric. Vector of length 2 giving left and right limits of the spatial grid, data outside these limits is excluded. |
ylim |
numeric. Vector of length 2 giving lower and upper limits of the spatial grid, data outside these limits is excluded. |
ply |
SpatialPolygons, or SpatialGridDataFrame. Cropping polygon |
... |
Not used |
Converts sp spatial objects from class SpatialGridDataFrame
to SpatialPolygonsDataFrame
.
Spatial polygons can then be transformed to a different projection or datum with spTransform
in package rgdal.
Image files created with spatial polygons are reduced in size and result in a much "cleaner" version of your image.
Returns an object of SpatialPolygonsDataFrame.
The objects data
slot is a data frame, number of rows equal to
the number of Polygons
objects and a single column containing values of z
.
If level
is true, z
values are set equal to the midpoint between breakpoints.
The status of the polygon as a hole or an island is taken from the ring direction,
with clockwise meaning island, and counter-clockwise meaning hole.
The traditional R graphics model does not draw polygon holes correctly,
holes overpaint their containing Polygon
object using a user defined background color (white by default).
Polygon holes are now rendered correctly using the plot
method for spatial polygons (SpatialPolygons-class
),
see polypath
for more details.
The Trellis graphics model appears to rely on the traditional method so
use caution when plotting with spplot
.
J.C. Fisher, U.S. Geological Survey, Idaho Water Science Center
A general explanation of the algorithm provided here; inspiration provided here.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Not run:
data(meuse.grid, package = "sp")
sp::coordinates(meuse.grid) <- ~ x + y
sp::gridded(meuse.grid) <- TRUE
meuse.grid <- as(meuse.grid, "SpatialGridDataFrame")
meuse.plys <- Grid2Polygons(meuse.grid, "dist", level = FALSE)
op <- par(mfrow = c(1, 2), oma = rep(0, 4), mar = rep(0, 4))
sp::plot(meuse.plys, col = heat.colors(length(meuse.plys)))
title("level = FALSE", line = -7)
meuse.plys.lev <- Grid2Polygons(meuse.grid, "dist", level = TRUE)
sp::plot(meuse.plys.lev, col = heat.colors(length(meuse.plys.lev)))
title("level = TRUE", line = -7)
par(op)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.