It is easy to get Vectorlayers into R from a PostgreSQL+PostGIS solution.
library(rgdal) dsn="PG:dbname=plots host=localhost user=test password=test" plots = readOGR(dsn,"Plots")
But how to do the same for raster layers stored in-db and/or out-db? I am a bit confused if this is even possible as I haven't found any help or similar questions on the net.
At least readGDAL finds the driver, but returns error messages that I am unsure how to handle.
>dsn="PG:dbname=plots host=localhost user=test password=test port=5432" >readGDAL(dsn,"map") PG:dbname=test host=localhost user=test password=test port=5432 has GDAL driver PostGISRaster and has 0 rows and 0 columns Error in offset/(cellsize/abs(gt)) : non-numerical arguement in binary operator additional: Warnings: 1: In dim(x) : no bands in dataset 2: In dim(x) : no bands in dataset
The imported raster should be fine as I can load it via QGIS. If this is possible can someone provide a working example?
OS: Debian Jessie + PostgreSQL 9.4dev + PostGIS 2.. R.version > 3.0.0
rgdal: version: 0.9-1, (SVN revision 518) Geospatial Data Abstraction Library extensions to R successfully loaded Loaded GDAL runtime: GDAL 1.10.1, released 2013/08/26 Path to GDAL shared files: /usr/share/gdal/1.10 Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480] Path to PROJ.4 shared files: (autodetected)
GDALInfo (even if pointed directly to table):
>dsn="PG:dbname=plots host=localhost user=test password=test port=5432 table=map" >rgdal::GDALinfo(dsn) Error in .local(.Object, ...) : Error retrieving raster metadata