0

I am using a shapefile and I am getting the following error when I use the spTransform function.

"Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘spTransform’ for signature ‘"list", "CRS"’".

Does anyone know how I can work around this issue? Below is my code:

dlshape=function(shploc, shpfile) {
  temp=tempfile()
  download.file(shploc, temp)
  unzip(temp)
  shp.data <- sapply(".", function(f) {
    fp <- file.path(temp, f)
    return(readOGR('.',layer= shpfile))
  })
}

ST<- dlshape(shploc = 'http://www2.census.gov/geo/tiger/GENZ2015/shp/cb_2015_us_county_20m.zip', 
             shpfile= "cb_2015_us_county_20m")

us_aea <- spTransform(ST, CRS("+proj=laea +lat_0=45 +lon_0=-100 +x_0=0 +y_0=0 +a=6370997 +b=6370997 +units=m +no_defs"))

Thanks

bryven
  • 23
  • 1
  • 4

0 Answers0