Re: [R-sig-Geo] Delimit a polygon for the region which is, 1000 m from my raster altitude

2015-05-03 Thread sadaoui
Ok thank you Robert Hijmans If you want to keep the raster cell values, you could do shapefile(pol2, polygon2.shp) and use that file. On Sat, May 2, 2015 at 2:10 PM, sadaoui lt;sadaouimahrez@gt; wrote: Thank you Robert Hijmans, it works with this function ; shapefile(pol3,

Re: [R-sig-Geo] Delimit a polygon for the region which is, 1000 m from my raster altitude

2015-05-02 Thread José M. Blanco Moreno
You can try fiddling a bit with: pol2 - rasterToPolygons(r, fun=function(x){x6}, dissolve = TRUE) pol3 - gBuffer(pol2,width=1e-5, byid=FALSE) Where the width is sufficiently small as to not affect the general shape. However, it yields very jagged polygons, which I do not know if it is what you

Re: [R-sig-Geo] Delimit a polygon for the region which is, 1000 m from my raster altitude

2015-05-02 Thread sadaoui
Thank you very much José M. Blanco Moreno for your answer. I have followed your instructions from this script : library(raster) library(sp) f - system.file(external/test.grd, package=raster) r - raster(f) # add polygon library(rgeos) pol2 - rasterToPolygons(r, fun=function(x){x500}, dissolve

Re: [R-sig-Geo] Delimit a polygon for the region which is, 1000 m from my raster altitude

2015-05-02 Thread sadaoui
Thank you Robert Hijmans, it works with this function ; shapefile(pol3, polygon3.shp) but I want to have the corresponding data to this shapefile. I tried, as did you say : or use the SpatialPolygons object to create a SpatialPolygonsDataFrame and then use writeOGR (that is what the

Re: [R-sig-Geo] Delimit a polygon for the region which is, 1000 m from my raster altitude

2015-05-02 Thread Robert J. Hijmans
If you want to keep the raster cell values, you could do shapefile(pol2, polygon2.shp) and use that file. On Sat, May 2, 2015 at 2:10 PM, sadaoui sadaouimah...@outlook.com wrote: Thank you Robert Hijmans, it works with this function ; shapefile(pol3, polygon3.shp) but I want to have

Re: [R-sig-Geo] Delimit a polygon for the region which is 1000 m from my raster altitude

2015-05-01 Thread sadaoui
Thank you very much MacQueen, Don for your answer. I have followed your instructions from this script : library(raster) library(sp) f - system.file(external/test.grd, package=raster) r - raster(f) # add contour x - rasterToContour(r,levels=500) class(x) plot(r) plot(x, add=TRUE) #export

Re: [R-sig-Geo] Delimit a polygon for the region which is 1000 m from my raster altitude

2015-04-30 Thread MacQueen, Don
Look into the help page for the contour function in the raster package It refers to RasterToContour Follow the example given in ?RasterToContour (copied here) f - system.file(external/test.grd, package=raster) r - raster(f) x - rasterToContour(r, levels=500) class(x) plot(r) plot(x, add=TRUE)