coerce SpatialPolygonsDataFrame to SpatialLinesDataFrame for plotKML
For purposes of sharing data in a form that may be visualized on shipboard chart plotters, I wish to export contours as a KML(or KMZ) of lines with a color corresponding to a contour level. I have generated the contours as SpatialPolygonsDataFrame from kernel density estimators in adehabitatHR. Is there a handy means to coerce the outlines SpatialPolygonsDataFrame into a SpatialLinesDataFrame object to facilitate this KML/KMZ export? ######################################################### ### Here is a toy example of what I wish to have require(adehabitatHR) data(puechabonsp) ## load animal movement data loc <- puechabonsp$relocs (ud <- kernelUD(loc[,1])) ## estimate utilization distribution ct <- 95 ## Specify the contour level ver <- getverticeshr(ud, percent=ct) ## extract the home-range contours class(ver) ## this produces a SpatialPolygonsDataFrame object #### Here I want to export the home range as a line into a KML/KMZ file #### I want a function that will do this ver.sLinesdf<-coerceToSpatialLinesDataFrame(ver) class(ver.sLinesdf) ## returns SpatialLinesDataFrame plotKML(ver.sLinesdf, colour=ct) ## Generate KMZ and color using the contour level ######################################################### ----- Tony Fischbach, Wildlife Biologist Walrus Research Program Alaska Science Center U.S. Geological Survey 4210 University Drive Anchorage, AK 99508-4650 AFischbach at usgs.gov http://alaska.usgs.gov/science/biology/walrus -- View this message in context: http://r-sig-geo.2731867.n2.nabble.com/coerce-SpatialPolygonsDataFrame-to-SpatialLinesDataFrame-for-plotKML-tp7580986.html Sent from the R-sig-geo mailing list archive at Nabble.com.