[R-sig-Geo] Issues with a GDB file in R?
Cotton Rockwood
crockwood at pointblue.org
Wed May 2 20:56:09 CEST 2018
Hi Roman -
As far as I know, 'readOGR' does not read tables in file geodatabases. (see https://gis.stackexchange.com/questions/184013/read-a-table-from-an-esri-file-geodatabase-gdb-using-r). 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://land.copernicus.eu/pan-european/corine-land-cover/clc-2012?tab=download
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
http://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/administrative-units-statistical-units
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://stat.ethz.ch/mailman/listinfo/r-sig-geo
More information about the R-sig-Geo
mailing list