Skip to content
Prev 17012 / 29559 Next

R 3.0.0 and spatial classes

On Thu, 20 Dec 2012, Francis Markham wrote:

            
If the geometry is simple, why not construct a WKT string and use 
available functions? Try:

library(rgeos)
set.seed(1)
coords.1 <- runif(10)
coords.2 <- runif(10)
crds <- paste(coords.1, coords.2)
crdstr <- paste(crds, collapse=",", sep="")
WKT <- paste("LINESTRING(", crdstr, ")", sep="")
g2 <- readWKT(WKT)
class(g2)

The same use of readWKT() of course extends to other WKT flavours.

Hope this helps,

Roger