[R-sig-Geo] creating a shp file from a tiff file

Brian Oney zenlines at gmail.com
Sat May 14 20:05:50 CEST 2011


Hi Erin,

depending on what you would like to there are a few functions in the
raster package that  may help. If you have a raster and would just like
the outline of it I would reccommend:

library(spgrass6)
gisDbase<-"D:/GIS_Database/"

sgdf<- readGDAL(fname='raster.tif', p4s="+proj=longlat +datum=WGS84
+ellps=WGS84 +towgs84=0,0,0")

initGRASS("C:/Program_Files_x86/GRASS-64", home=tempdir(),SG=sgdf,
gisDbase=gisDbase,location='loc', mapset='urmapset', override=T)

rasters<- execGRASS("g.mlist", parameters=list(type="rast"),intern=T)

execGRASS("r.to.vect", flags=c("s"), parameters=list(input=rasters,
output=nameit, feature="area"))

execGRASS("v.out.ogr", flags=c("e"), parameters=list(input=nameit,
type="area",
       dsn=shpbase, olayer='vector', format="ESRI_Shapefile"))

I would reccommend getting familiar with GRASS and the spgrass6 package
for (additional) geographic/remote sensing tasks.
With large amounts of data (to process) GRASS performs especially well.

hth,
Brian


On 5/14/2011 12:00 PM, r-sig-geo-request at r-project.org wrote:
>    [R-sig-Geo] creating a shp file from a tiff file



More information about the R-sig-Geo mailing list