Skip to content
Prev 7486 / 29559 Next

Shows error when I try to write shape file-Re: Combing attribute table with polygon??

Hi, Roberts,
In my last mail, I mentioned it works fine,  but when I try write shape 
file after merging it shows error. I think I need to  define  spatial 
object or data frame after merging. I do not know  how to do this. 
Thanks again.
Zia

 > poly.data1 = merge(poly.data, data.table, by="MUKEY" ,all.x = TRUE)
 > names(poly.data1) # polygoan
 [1] "MUKEY"      "AREASYMBOL" "SPATIALVER" "MUSYM"      "Sand"     
 [6] "Silt"       "Clay"       "pH"         "CEC"        "EC"       
[11] "SAR"        "CaCO3"      "SOM"        "BD"         "AWC"      
[16] "KSAT"       "Kf"         "Kw"         "LL"         "LEP"      

 >polyShp <- "D:/test/mapunit_poly.shp" 
 > writeOGR(poly.data1, dsn=polyShp, layer="mapunit_poly", driver="ESRI 
Shapefile")
Error in writeOGR(poly.data1, dsn = polyShp, layer = "mapunit_poly", 
driver = "ESRI Shapefile") :
  obj of wrong class
Zia Ahmed wrote: