SpatialLines2PolySet

0th

Percentile

Convert sp line and polygon objects to PBSmapping PolySet objects

Functions SpatialLines2PolySet and SpatialPolygons2PolySet convert objects of sp classes to PolySet class objects as defined in the PBSmapping package.

Keywords
spatial
Usage
SpatialLines2PolySet(SL)
SpatialPolygons2PolySet(SpP)
Arguments
SL
a SpatialLines object as defined in the sp package
SpP
a SpatialPolygons object as defined in the sp package
Value

  • PolySet objects as defined in the PBSmapping package

See Also

as.PolySet, MapGen2SL

Aliases
  • SpatialLines2PolySet
  • SpatialPolygons2PolySet
Examples
library(PBSmapping)
library(maps)
nor_coast_lines <- map("world", interior=FALSE, plot=FALSE, xlim=c(4,32), ylim=c(58,72))
nor_coast_lines <- pruneMap(nor_coast_lines, xlim=c(4,32), ylim=c(58,72))
nor_coast_lines_sp <- map2SpatialLines(nor_coast_lines, proj4string=CRS("+proj=longlat +datum=wgs84"))
nor_coast_lines_PS <- SpatialLines2PolySet(nor_coast_lines_sp)
summary(nor_coast_lines_PS)
plotLines(nor_coast_lines_PS)
nor_coast_poly <- map("world", "norway", fill=TRUE, col="transparent", plot=FALSE, ylim=c(58,72))
IDs <- sapply(strsplit(nor_coast_poly$names, ":"), function(x) x[1])
nor_coast_poly_sp <- map2SpatialPolygons(nor_coast_poly, IDs=IDs, proj4string=CRS("+proj=longlat +datum=wgs84"))
nor_coast_poly_PS <- SpatialPolygons2PolySet(nor_coast_poly_sp)
summary(nor_coast_poly_PS)
plotPolys(nor_coast_poly_PS)
Documentation reproduced from package maptools, version 0.6-3, License: GPL version 2 or later (R and interface code), MIT (shapelib code)

Community examples

Looks like there are no examples yet.