Roger Bivand a écrit :
On Sat, 7 Aug 2010, Patrick Giraudoux wrote:
Dear All,
I have just discovered the fantastic possibilities given with
kmlPolygon, klmLine and kmlOverlay (package maptools) to project
spatial objects into google earth.
Does anyone knows if a function equivalent has been written to create
a kml file of "points" ? If not, is there a technical reason not to
have done it or a workaround which would make such function unecessary ?
Would the KML driver for writeOGR() in rgdal be enough? The variables
(or a subset of the variables) in the SpatialPointsDataFrame are
displayed in the bubble on clicking. You do not, I think, get a choice
of point symbol.
td <- tempdir()
data(meuse)
coordinates(meuse) <- c("x", "y")
proj4string(meuse) <- CRS("+init=epsg:28992")
meuse_ll <- spTransform(meuse, CRS("+proj=longlat +datum=WGS84"))
writeOGR(meuse_ll, paste(td, "meuse.kml", sep="/"), "zinc", "KML")
file.show(paste(td, "meuse.kml", sep="/"))
See http://www.gdal.org/ogr/drv_kml.html, and note the section on
encoding if on Windows.
Roger
Sure, likely to be exactly what I need. I was not aware of this kml
driver in rdgal (I was ready to write down a function...).
Thanks a lot,
Patrick
Patrick
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo