Hey everyone!

I try to convert severall raster files into a dataframe and then store them in a postegresql database using the RPostgreSQL package (see code example below). The for loop below should ideally attach each rasters dataframe to the existing table "modis" created with the first raster (therefore append=TRUE). However, if the program has finished, only the first raster has been stored. Any ideas why this does not work?

Code:

for (i in tar){
    raster<-raster(i)
    data<-as.data.frame(raster)
    dbWriteTable(con,"modis",data,append=TRUE)
}

Where: "tar" is a list of raster files, "con" a database connection file and "modis" the database table to be created.

Thanks!

Cornelius

--
__________________________
Cornelius Senf, Bsc.
Humboldt-University of Berlin
Geography Department
Geomatics Lab

www.hu-geomatics.de

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to