Short version: how can I get into R the dataset available at this link? (you need to log in to download, but registration is free)

The dataset that is downloadable at that link expands to a directory; as pointed out in the comments, this is an ESRI file geodatabase, and the important stuff is in a subdirectory. The format was reverse engineered and is readable by GDAL:

$ ogrinfo eschscholzia_minutiflora_twisselmannii/data/v93/tempgdb.gdb
Had to open data source read-only.
INFO: Open of `eschscholzia_minutiflora_twisselmannii/data/v93/tempgdb.gdb'
  using driver `OpenFileGDB' successful.
1: Eschscholzia_minutiflora_ssp_twisselmannii (Multi Polygon)

However, reading this into R results in:

x <-readOGR('eschscholzia_minutiflora_twisselmannii/data/v93/tempgdb.gdb', 'Eschscholzia_minutiflora_ssp_twisselmannii')

Error in readOGR("eschscholzia_minutiflora_twisselmannii/data/v93/tempgdb.gdb",  :
Unsupported field type: Binary

Another tack, using ogr2ogr, produces a shapefile:

$ ogr2ogr --mapFieldType Binary=Integer test_output eschscholzia_minutiflora_twisselmannii/data/v93/tempgdb.gdb/
Warning 6: Normalized/laundered field name: 'FOOTPRINT_Length' to 'FOOTPRINT_'
Warning 6: Normalized/laundered field name: 'FOOTPRINT_Area' to 'FOOTPRIN_1'
Warning 1: Value 121687920 of field FOOTPRINT_ of feature 0 not successfully written. Possibly due to too larger number with respect to field width
Warning 1: Value 925496867120400 of field FOOTPRIN_1 of feature 0 not successfully written. Possibly due to too larger number with respect to field width

but the resulting shapefile doesn't seem to have the information in it. Or, maybe I don't know the right way to read it into R?

  • You can read it directly into R with rgdal::readOGR, try "x <- readOGR('eschscholzia_minutiflora_twisselmannii/data/v93/tempgdb.gdb', 'Eschscholzia_minutiflora_ssp_twisselmannii')" but no idea about the .lyr file specifically. See ?ogrListLayers to discover information about the layer/s in the data set. – mdsumner Dec 21 '15 at 4:48
  • That doesn't work (see revised post): maybe this has to do with the new mapFieldType option? – petrelharp Dec 21 '15 at 5:10
  • The main file you're downloading is an Esri File Geodatabase, so you could check the R documentation to see whether they explain how to work with this (the *.lyr layer file is used within Esri software to provide ready-made symbols, labels, etc and doesn't contain any actual content) – Stephen Lead Dec 21 '15 at 5:24
  • This may also help: gis.stackexchange.com/a/151622/3112 – Stephen Lead Dec 21 '15 at 5:27
  • @stephen-lead Thanks. It seems the problem is the Binary format of the fields? – petrelharp Dec 21 '15 at 5:50

Those data are rasters, and sadly (as of December 2015) it seems there's no way to read file geodatabase rasters with open source tools. The nice folk(s) who reverse-engineered the format haven't done rasters, and as described in this question, ESRI isn't helping. =(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.