gFrom: Derive a 'geom' from other spatial objects

Description Usage Arguments Value Examples

View source: R/geom_tools.r

Description

See geom-class for details on differences between objects of class geom and other spatial classes.

Usage

1
gFrom(input)

Arguments

input

[Spatial* | sf]
the spatial object to build a geom from.

Value

a geom of the type that comes closest to the type of the input.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
require(sp)
pol1 <- Polygon(cbind(c(4, 4, 5, 7, 4),c(5, 3, 2, 5, 5)))
pol2 <- Polygon(cbind(c(4.5, 5.5, 5.5, 5, 4.5, 4.5),
                      c(4.5, 4, 3.5, 3, 3, 4)),
                      hole = TRUE)
poly <- Polygons(list(pol1, pol2), "1")
spPoly <- SpatialPolygons(list(poly))
plot(spPoly, col = "goldenrod")

myGeom <- gFrom(input = spPoly)
visualise(geom = myGeom)

EhrmannS/rasterTools documentation built on Feb. 4, 2019, 11:22 a.m.