How do I export a polygon created by drawPoly as a shapefile?

6

I created a shape using the drawPoly() (package raster ) function that manually draws the polygon. At the end of the selection it generates a SpatialPolygon , but I can not export because it is not a SpatialPolygonDataFrame . What should I do?

    
asked by anonymous 17.11.2015 / 13:58

1 answer

4

The rgdal package allows you to do this with the command writeOGR() .

Assuming your polygon is in the poly variable, the following command would suffice: writeOGR(obj = poly, dsn = 'NomeDoArquivo.shp', layer = 'NomeDoLayer', driver = 'ESRI Shapefile')

    
17.11.2015 / 20:36