2

I am having issues with handling georaster-tables from Oracle-databases in R with ROracle-package and I am wondering if ROracle is able to match Oracles georaster-datatype to R-datatypes, cause everytime I do something like

dbReadTable(con,'MS_PICS')

I get the error message:

Error in .oci.GetQuery(con, qry) : unsupported column type

This is my connection, which works fine:

library('DBI')
library('ROracle')
library('sp')
library('raster')
drv <- dbDriver('Oracle')
host <- 'XXX.XX.XX.XX'
port <- 1521
sid <- 'TestDB'
connect.string <- paste(
  "(DESCRIPTION=",
  "(ADDRESS=(PROTOCOL=tcp)(HOST=", host, ")(PORT=", port, "))",
  "(CONNECT_DATA=(SID=", sid, ")))", sep = "")
con <- dbConnect(drv, username = "XXXXX", password = "XXXXX",
                 dbname = connect.string)

This is my workaround solution for now, which reads the cell values of every single pixel serverside and sends it to R as a number and puts it in a new raster.

red <- raster(nrows=25, ncols=25)
timeSTART<-Sys.time()

for (i in 1:25) {
  for (j in 1:25) {
    red[j,i] <- dbGetQuery(con, paste('SELECT sdo_geor.getCellValue(image,0,',(j-1),',',(i-1),',0) 
      Value FROM ms_pics WHERE rasterid=3',sep=''))[1,1]
  }
}

time<-Sys.time()-timeSTART

This works for a 25x25-pixel testraster and lasts around 30secs. So this is not a solution for proper rasters as it would last ages and I am also losing the spatial information.

Does anybody know if ROracle is able to handle rasters from Oracle-databases and how this works?

If not, is there a smarter workaround than mine?

4

0 回答 0