Unable to load Postgresql spatial data in R (with rgdal)

المشرف العام

Administrator
طاقم الإدارة
I'm trying to load spatial data from a postgresql database in R, using functions from the package rgdal, but I'm having trouble getting the functions to work.

For example, when trying to read a raster:

GDALinfo("PG:dbname=db host=localhost user=user schema=data table=srtm_dem port=5432")

Error in .local(.Object, ...) : `C:\Users\username\Documents\PG:dbname=db host=localhost user=user schema=data table=srtm_dem port=5432' does not exist in the file system,and is not recognised as a supported dataset name.The function appears to just append the working directory to the connection string. I've tried the connection string with many different arguments but the same problem occurs every time.

Likewise, with vector tables, an even less-informative error is given:

ogrInfo("PG:dbname=db host=localhost user=user ", layer = "data.roads")

Error in ogrInfo("PG:dbname=db host=localhost user=user ", layer = "data.roads") : Cannot open file

Again, I've tried modifying the connection strings in many different ways. Anyone with similar issues or ideas as to what might be happening?



أكثر...
 
أعلى