[R-sig-Geo] readOGR, PostGIS - problem with schemas

Albin Blaschka albin.blaschka at standortsanalyse.net
Mon Nov 14 09:03:08 CET 2011


Dear List,

if I try to open a postgis-layer via readOGR and the layer/table is in a 
schema (layer = myschema.mytable), I get an error stating that the layer 
can not be found - but the layer *is* there.

mylayer <-
readOGR(dsn="PG:host=127.0.0.1 user=username dbname=mydb password=secret 
port=5432", layer = "myschema.mylayer", verbose = TRUE)

if I take a layer in the "public" schema and put in the parameter 
"layer" just the tablename (layer = mylayer), it works, if I say "layer 
= public.mylayer", the layer is not found, too

If I try outside of R on the commandline the ogr* - commands 
(ogrinfo...), everything works as expected, for example

 > ogrinfo "PG:host=127.0.0.1 user=username dbname=mydb password=secret 
port=5432" "myschema.mylayer"

INFO: Open of `PG:host=127.0.0.1 user=username dbname=mydb 
password=secret port=5432' using driver `PostgreSQL' successful.

Layer name: myschema.mylayer
[...snip...]

So, the problem lies within the schema.table - notation... Is that a 
known limitation, or did I miss something?

Session Info: (I am on Ubuntu 11.10 "Onereiric")

R version 2.14.0 (2011-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
  [1] LC_CTYPE=de_AT.UTF-8       LC_NUMERIC=C 
LC_TIME=de_AT.UTF-8        LC_COLLATE=de_AT.UTF-8
  [5] LC_MONETARY=de_AT.UTF-8    LC_MESSAGES=de_AT.UTF-8    LC_PAPER=C 
                LC_NAME=C
  [9] LC_ADDRESS=C               LC_TELEPHONE=C 
LC_MEASUREMENT=de_AT.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
  [1] rgdal_0.7-3        RPostgreSQL_0.2-0  DBI_0.2-5 
RColorBrewer_1.0-5 maptools_0.7-38    lattice_0.20-0
  [7] sp_0.9-81          foreign_0.8-46     spatstat_1.24-2 
deldir_0.0-16      mgcv_1.7-10

loaded via a namespace (and not attached):
[1] grid_2.14.0  Matrix_1.0-1 nlme_3.1-102 tools_2.14.0

Thank you,
Albin


-- 
| Albin Blaschka, Mag.rer.nat.
| Etrichstrasse 26, A-5020 Salzburg
| * www.albinblaschka.info * www.thinkanimal.info *
| - It's hard to live in the mountains, hard but not hopeless!



More information about the R-sig-Geo mailing list