[R-sig-Geo] reading geopackage gpkg with readOGR

Roger Bivand Roger@B|v@nd @end|ng |rom nhh@no
Tue Apr 13 12:55:31 CEST 2021


On Tue, 13 Apr 2021, Bede-Fazekas Ákos wrote:

> Dear Patrick,

In rgdal, the available drivers are found with ogrDrivers(), which  you 
may check. Which platform is  this and if a source install, how was GDAL 
installed? Layers in vector data sources (dsn) are found with

ogrListLayers(dsn)

where dsn is the (path to and) GPKG name. 
ogrListLayers("./Shapes/trspixNaratiUTM44_alt_UTM44.gpkg") may show 
several layers (but should choose the first by default when reading). are 
there any other messages?

Roger

> please take a look at sf::st_layers(dsn), this gives you the name of, and 
> basic information on, the layers found in the specific file/folder (dsn).
> HTH,
> Ákos Bede-Fazekas
>
> 2021.04.13. 8:35 keltezéssel, Patrick Giraudoux írta:
>>  Dear listers,
>>
>>  I did not find the way to open a geopackage using rgdal::readOGR.
>>
>>  The package name is 'trspixNarati_alt_UTM44.gpkg' (with two companion
>>  files: 'trspixNarati_alt_UTM44.gpkg-shm' and
>>  'trspixNarati_alt_UTM44.gpkg-wal') stored in a folder 'Shapes'
>>
>>  The corresponding object should be a SpatialPointsDataFrame.
>>
>>  I have tried several combinations (a bit blind) with
>>
>>  readOGR("./Shapes/trspixNaratiUTM44_alt_UTM44.gpkg")
>>
>>  readOGR("./Shapes/","trspixNaratiUTM44_alt_UTM44.gpkg")
>>
>>  readOGR("./Shapes/","trspixNaratiUTM44_alt_UTM44")
>>
>>  with no success...
>>
>>  This link https://jsta.github.io/2016/07/14/geopackage-r.html gives
>>  indications on the how to to it, but supposes that one knows a layer
>>  name (which is not my case)
>>
>>  Any idea about the syntax of this driver ?
>>
>>  Best,
>>
>>  Patrick
>> 
>>
>>   [[alternative HTML version deleted]]
>>
>>  _______________________________________________
>>  R-sig-Geo mailing list
>>  R-sig-Geo using r-project.org
>>  https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>

-- 
Roger Bivand
Emeritus Professor
Department of Economics, Norwegian School of Economics,
Postboks 3490 Ytre Sandviken, 5045 Bergen, Norway.
e-mail: Roger.Bivand using nhh.no
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en


More information about the R-sig-Geo mailing list