Skip to content
Prev 25219 / 29559 Next

display location on google earth

Hi;I have a shapefile named 'Wolf' that I can display in google with the following code:??# Show the shapefile on top of google
?writeOGR(Wolf, "Wolf.kml", "Wolf", driver="KML")?????? 
?system("open Wolf.kml") 

However, I am having problems with a single set of coordinates that I would like to use to display a location.Could someone show me how to display on google with the following coordinates?
?Latitude 38?34'02",?? Longitude 121?23'14"?? NAD27
I have tried:
?require(rgdal)
?library(sp) 
lat <- '38.34477586' 
?lon <- '-121.23387625' 

?# make a data frame 
?coords <- as.data.frame(cbind(lon=lon,lat=lat))
?coords
?# make it a spatial object 
?coordinates(coords) <- ~lat+lon 
?coords <- spTransform(coords)

But I am getting the following error:
Error in (function (classes, fdef, mtable)? : 
? unable to find an inherited method for function ?spTransform? for signature ?"CRS", "missing"?