How to export a polygon created by drawPoly as shapefile?

Asked

Viewed 117 times

6

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

1 answer

4


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

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.