[R-sig-Geo] PostGIS layer to R using OGR driver imports unwanted raster column as String

Roger Bivand Roger.Bivand at nhh.no
Wed Nov 30 15:01:54 CET 2016


OK, what does ogr2ogr do in GDAL2? I do not have any experience of the driver you are using, so others will have to try to repicate - do you have a reproducible case? What does rgdal::ogrListLayers() say?

Roger
--
Roger Bivand
Norwegian School of Economics
Helleveien 30, 5045 Bergen, Norway
Roger.Bivand at nhh.no


________________________________________
Fra: Vilem Ded [Ded.V at seznam.cz]
Sendt: 30. november 2016 2:56
Til: Roger Bivand
Kopi: R-Sig_Geo"
Emne: Re: [R-sig-Geo] PostGIS layer to R using OGR driver imports  unwanted raster column as String

Hi,
thx for idea. When rgdal is attached:

Loading required package: sp
rgdal: version: 1.1-10, (SVN revision 622)
 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)
 Linking to sp version: 1.2-3

gdal-config --version  really showed version 1, so I have installed gdal2 from source.

Now the rgdal attaching gives me:

Loading required package: sp
rgdal: version: 1.2-4, (SVN revision 643)
 Geospatial Data Abstraction Library extensions to R successfully loaded
 Loaded GDAL runtime: GDAL 2.1.2, released 2016/10/24
 Path to GDAL shared files: /usr/local/share/gdal
 Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480]
 Path to PROJ.4 shared files: (autodetected)
 Linking to sp version: 1.2-3

readOGR throws an error when running the same command as before:

obj <- rgdal::readOGR(dsn="PG:dbname=DB host=HOST user=USER password=PSSWD port=5432", layer = "SCHEMA.TABLE(LAYER)")
Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv,  :
  Layer not found

And now ,as expected from error, function ogrInfo() works differently. It throws the same error and work only without specification of LAYER (e.g. layer = "SCHEMA.TABLE")

Some more ideas? Thank you.





---------- Původní zpráva ----------
Od: Roger Bivand
Komu: Roger Bivand , Vilem Ded , Help
 R-Sig_Geo
Datum: 30. 11. 2016 12:53:32
Předmět: Re: [R-sig-Geo] PostGIS layer to R using OGR driver imports
 unwanted raster column as String



Briefly, could you add a copy of the startup messages when rgdal is attached, and the version of gdal shown by gdal-config --version? Maybe gdal2 would do better if you are on gdal1?


Roger


Roger Bivand

Norwegian School of Economics

Bergen, Norway




Fra: Vilem Ded

Sendt: onsdag 30. november, 11.11

Emne: [R-sig-Geo] PostGIS layer to R using OGR driver imports unwanted raster column as String

Til: Help R-Sig_Geo


Hi, right to the point. I  am trying to load spatial layer from postgis database to R: obj






More information about the R-sig-Geo mailing list