[R-sig-Geo] save SpatialPolygonsDataFrame as dxf file

Milan Cisty milan.cisty at stuba.sk
Tue Dec 1 16:23:52 CET 2015


Hello,
I would like to save SpatialPolygonsDataFrame as dxf file. Sorry if I am
doing trivial mistake, but please what is wrong on this:

p = Polygon(coords = matrix(c(1,2,2,1,1,1,2,2), ncol = 2))    #this is
square 1x1
p1= Polygons(list(p), ID=1)
p2=SpatialPolygons(list(p1))
p3=SpatialPolygonsDataFrame(p2, data = as.data.frame("1"))
writeOGR(p3, dsn = "square.dxf", layer = "entities", driver="DXF")

and last command gave me following message:
Error in writeOGR(p3, dsn = "square.dxf", layer = "entities", driver =
"DXF") : 
  Creating Name field failed
(some dxf file was produced, but it has nothing drawn in it)
Thanks,
Milan



More information about the R-sig-Geo mailing list