Skip to content

kml and points

5 messages · Roger Bivand, Patrick Giraudoux, Felipe Carrillo

#
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 ?

Patrick
#
On Sat, 7 Aug 2010, Patrick Giraudoux wrote:

            
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

  
    
#
Roger Bivand a ?crit :
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
#
Can google earth be open from R along with the meuse.kml overlayed on top of it?
?
Felipe D. Carrillo
Supervisory Fishery Biologist
Department of the Interior
US Fish & Wildlife Service
California, USA



----- Original Message ----