[R-sig-Geo] Issues with a GDB file in R?

Barbour, Russell russell.barbour at yale.edu
Thu May 3 14:34:02 CEST 2018


Please unsubscribe me from this list

Russell “Skip” Barbour Ph.D.
Associate  Director, 
Interdisciplinary Research Methods Core
Center for Interdisciplinary Research on AIDS 
Yale SCHOOL OF PUBLIC HEALTH
135 College Street, Suite 200, New Haven, CT 06510
Tel:203-764-4332 email:russel.lbarbour at yale.edu
http://cira.yale.edu/people/russell-barbour-phd 

“"You just think lovely wonderful thoughts," Peter explained, "and they lift you up in the air.”
Peter Pan teaching Wendy how to fly

-----Original Message-----
From: R-sig-Geo [mailto:r-sig-geo-bounces at r-project.org] On Behalf Of Cotton Rockwood
Sent: Wednesday, May 2, 2018 2:56 PM
To: Aguirre Perez, Roman <ra454 at exeter.ac.uk>; r-sig-geo at r-project.org
Subject: Re: [R-sig-Geo] Issues with a GDB file in R?

Hi Roman -

As far as I know, 'readOGR' does not read tables in file geodatabases. (see https://urldefense.proofpoint.com/v2/url?u=https-3A__gis.stackexchange.com_questions_184013_read-2Da-2Dtable-2Dfrom-2Dan-2Desri-2Dfile-2Dgeodatabase-2Dgdb-2Dusing-2Dr&d=DwIGaQ&c=cjytLXgP8ixuoHflwc-poQ&r=hqlhsfPkcleHC6lIU7H-PK6ab0cWjzsLSsRESstmcuM&m=AyJmViJgTgWrKjYVj6e7XUAt5NWdIU_UynXzlW-ynw8&s=VNhaJinb3W90c6yiWpvXy2FKFi0wRu2659-E_P-IGxo&e=). I'm guessing this is the problem you are running into with R. In addition to Sean's suggestions, you might also want to try using the 'sf' package since it can read file geodatabase tables and usually increases read times (and other spatial operations) significantly compared to 'sp' and 'readOGR'. I'm not sure if it will address the issues you seem to be having with the geometries as suggested by the GRASS, QGIS and ArcGIS errors. The specific 'sf' function is:

'st_read' and the syntax is very similar to 'readOGR'.  You will need to make sure you have the newest version: 0.6-1.

-Cotton



-----Original Message-----

From: R-sig-Geo [mailto:r-sig-geo-bounces at r-project.org] On Behalf Of Aguirre Perez, Roman

Sent: Wednesday, May 02, 2018 10:35 AM

To: r-sig-geo at r-project.org

Subject: [R-sig-Geo] Issues with a GDB file in R?



Hi everyone,



I’ve been struggling with a ESRI Geodatabase file (clc12_Version_18_5.gdb) which is a layer of land cover classes available on



https://urldefense.proofpoint.com/v2/url?u=https-3A__land.copernicus.eu_pan-2Deuropean_corine-2Dland-2Dcover_clc-2D2012-3Ftab-3Ddownload&d=DwIGaQ&c=cjytLXgP8ixuoHflwc-poQ&r=hqlhsfPkcleHC6lIU7H-PK6ab0cWjzsLSsRESstmcuM&m=AyJmViJgTgWrKjYVj6e7XUAt5NWdIU_UynXzlW-ynw8&s=0H4NNqQ2_ZV2e4VJgk6EsYBt8vnOIuiFqvfiVC1VdaQ&e=



whose size is 2.61 GB once unzipped.



My ultimate task is to overlay it with the last NUTS3 administrative boundaries shapefile (2013) available on



https://urldefense.proofpoint.com/v2/url?u=http-3A__ec.europa.eu_eurostat_web_gisco_geodata_reference-2Ddata_administrative-2Dunits-2Dstatistical-2Dunits&d=DwIGaQ&c=cjytLXgP8ixuoHflwc-poQ&r=hqlhsfPkcleHC6lIU7H-PK6ab0cWjzsLSsRESstmcuM&m=AyJmViJgTgWrKjYVj6e7XUAt5NWdIU_UynXzlW-ynw8&s=On4UScxpDq3FXH_zMMi-4oexQ73Bol0dfV6ELlj18co&e=



in order to compute the area covered by each class within each NUTS3 region.



Despite the ease of friendly software for performing this task, haven’t been capable of doing it - GRASS didn’t load the file as the log reports problems with the polygons, QGIS shows a warning regarding a specific object and ArcGIS got frozen. I guess it’s because the PC I used doesn’t have enough capacity. Unfortunately, I don’t have access to a more powerful one.



Anyway, I decided to try with R -after all, I’ll perform my analysis with it. So I started exploring this GDB with rgdal:



ogrInfo(dsn="clc12_Version_18_5.gdb",layer="clc12_Version_18_5")



Source: "/Users/Roman/Desktop/clc12gdb/clc12_Version_18_5.gdb",

layer: "clc12_Version_18_5"

Driver: OpenFileGDB;

number of rows: 2370829

Feature type: wkbPolygon with 3 dimensions

Extent: (-2693292 -3086662) - (10037210 5440568) Null geometry IDs: 2156240

CRS: +proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs Number of fields: 6

name                      type  length  typeName

1 code_12              4       3           String

2 ID                         4       18         String

3 Remark               4       20         String

4 Area_Ha             2       0           Real

5 Shape_Length   2       0           Real

6 Shape_Area       2       0           Real



Then I tried to load it typing



clc<-readOGR(dsn="clc12_Version_18_5.gdb",layer="clc12_Version_18_5")



After 3-5 minutes, it appears the following text:



OGR data source with driver: OpenFileGDB

Source: "/Users/Roman/Desktop/clc12shp/clc12_Version_18_5.gdb", layer: "clc12_Version_18_5"

with 2370829 features

It has 6 fields



Unfortunately, after trying 5 times (each one took around 8 hours) I couldn’t get anything but the following messages:



Warning messages:

1: In readOGR(dsn = "clc12_Version_18_5.gdb", layer = "clc12_Version_18_5") :

Dropping null geometries: 2156240

2: In readOGR(dsn = "clc12_Version_18_5.gdb", layer = "clc12_Version_18_5") :

Z-dimension discarded



Could anyone advise me how to tackle it? I also would appreciate suggestions on how to work with geodatabases - it’s my first time I work with these kind of files so I don’t even know their structure.



By the way, these are my computer and software specifications:



MacBook Pro 2012

Processor 2.6 GHz Intel Core i7

Memory 16 GB DDR3

R 3.5.0

RStudio 1.1.447





Best,

Roman.



	[[alternative HTML version deleted]]



_______________________________________________

R-sig-Geo mailing list

R-sig-Geo at r-project.org

https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dsig-2Dgeo&d=DwIGaQ&c=cjytLXgP8ixuoHflwc-poQ&r=hqlhsfPkcleHC6lIU7H-PK6ab0cWjzsLSsRESstmcuM&m=AyJmViJgTgWrKjYVj6e7XUAt5NWdIU_UynXzlW-ynw8&s=pYHh6icaGQ-A3K8nOdCWGQyMRAFBs7p1a7SBozBPEfE&e=

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at r-project.org
https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dsig-2Dgeo&d=DwIGaQ&c=cjytLXgP8ixuoHflwc-poQ&r=hqlhsfPkcleHC6lIU7H-PK6ab0cWjzsLSsRESstmcuM&m=AyJmViJgTgWrKjYVj6e7XUAt5NWdIU_UynXzlW-ynw8&s=pYHh6icaGQ-A3K8nOdCWGQyMRAFBs7p1a7SBozBPEfE&e=


More information about the R-sig-Geo mailing list