[R] How can I save plot()/points() using SHP files into KML format?

gztourek gztourek at gmail.com
Thu Feb 23 00:43:57 CET 2012


Hi,

I am new to R and am a very basic user.  I'm importing SHP files, adding
plots of random locations within my polygon (these files have GPS data), and
then want to save these plots (intact with added points) as KML files to
look at in GoogleEarth (or possibly as SHP files which I can then convert
into KML).

This is as far as I've gotten (code below) and am lost as to next steps, 
Any suggestions or references would be greatly appreciated!  Thanks in
advance for any help.

Gabe

# Initialize pseudo random number generator

  set.seed(700124)

# Read vector representation of the map

  Kasur <- readOGR("Kasur3.shp", layer = "Kasur3")
  

# Plot points
  png("Kasur.png")
  plot(Kasur)
  points(spsample(Kasur, n=100, type='random'), col='red', pch=0, cex=0.5)
  dev.off()

--
View this message in context: http://r.789695.n4.nabble.com/How-can-I-save-plot-points-using-SHP-files-into-KML-format-tp4412220p4412220.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list