save SpatialPolygonsDataFrame as dxf file
On Tue, 1 Dec 2015, Milan Cisty wrote:
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)
No idea, nor can I find any example of how to use the file creation driver. This isn't a driver in active use anywhere really. I think that the issue is that DXF doesn't want attributes associated with geometries - to judge from copying p3 to GRASS and writing with v.out.dxf. writeOGR needs attributes. Roger
Thanks, Milan
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand Department of Economics, Norwegian School of Economics, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 91 00 e-mail: Roger.Bivand at nhh.no