Learn R Programming

spsurvey (version 3.4)

sp2shape: Convert an sp Package Object to an ESRI Shapefile

Description

This function creates an ESRI shapefile from an sp package object. The function can also accommodate an object created by the grts or irs functions in spsurvey. The type of shapefile, i.e., point, polyline, or polygon, is determined by the class of the input object, which must be either "SpatialDesign", "SpatialPointsDataFrame", "SpatialLinesDataFrame", or "SpatialPolygonsDataFrame".

Usage

sp2shape(sp.obj, shpfilename="tempfile", prjfilename=NULL)

Arguments

sp.obj

the sp package object or object created by either the grts or irs functions.

shpfilename

name (without any extension) of the output shapefile. The default is "tempfile".

prjfilename

name (without any extension) of the projection file for the output shapefile. The default is NULL.

Value

An ESRI shapefile of type point, polyline, or polygon.

References

ESRI Shapefile Technical Description: http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf

Examples

Run this code
# NOT RUN {
  
# }
# NOT RUN {
  sp2shape(my.sp.object, "my.shapefile")
  
# }

Run the code above in your browser using DataLab