[R-sig-Geo] display location on google earth
Felipe Carrillo
mazatlanmexico at yahoo.com
Thu Dec 29 18:51:33 CET 2016
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"’
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list