Convert ESRI shapefile (*.shp) to keyhole markup language (KML) file format

shp2kml(dir, ext, kmz = FALSE, proj4 = NULL, color = NULL,
  NameField = NULL, out.dir = NULL)

Arguments

dir

Directory of GIS shapefiles to convert to kml/kmz

ext

File extension for files to convert to kml/kmz. Defaults to ESRI shapefile, '.shp'. [Place holder for other potential vector files to conver to kml]

kmz

TRUE/FALSE. Option to write out file as a compressed kml. Requires zip utility

proj4

OPTIONAL. Define output proj4 projection string. If set, input vector will be reprojected to desired projection. Not yet implemented.

color

OPTIONAL. Fill color for output kml/kmz file

NameField

OPTIONAL. Define names for individual features in KML/KMZ file

out.dir

OPTIONAL. Output directory for converted files

Examples

# NOT RUN {
dir <- Sys.glob(file.path(R.home(), 'library', 'PEcAn.data.land','data'))
out.dir <- path.expand('~/temp')
shp2kml(dir,'.shp',kmz=FALSE,NameField='STATE',out.dir=out.dir)
system(paste('rm -r ',out.dir))
# }# NOT RUN {
# }