I am trying to read shapefiles contained within a geodatabase file (.gdb) into R. The .gdb contains two Feature Datasets with multiple Feature Classes within each.

The problem is only one of the two Feature Datasets is being read. Specifically, I am using the NHD dataset for all states ftp://nhdftp.usgs.gov/DataSets/Staged/States/FileGDB/HighResolution/ In each state .gdb are two feature Datasets, 'WBD' and 'Hydrography'. Only 'WBD' is being read. Using ogrListLayers only returns layers from 'WBD'. Can I specify the 'Hydrography' dataset and access the Feature Classes within it?

When I run orgListLayers, it returns:

[1] "ExternalCrosswalk"       "NHDFCode"                "NHDFeatureToMetadata"
[4] "NHDFlow"                 "NHDFlowlineVAA"          "NHDMetadata"            
[7] "NHDProcessingParameters" "NHDReachCodeMaintenance" "NHDReachCrossReference" 
[10] "NHDSourceCitation"       "NHDStatus"               "NHDVerticalRelationship"
[13] "WBDHU14"                 "WBDHU8"                  "WBDHU2"                 
[16] "WBDHU4"                  "WBDHU6"                  "WBDHU10"                
[19] "WBDHU12"                 "WBDHU16"                 "HYDRO_NET_Junctions" 

Yet others get:

[1] "NHDPoint"                    "NHDFlowline"                 "NHDLine"                    
[4] "NHDArea"                     "NHDWaterbody"                "NHDAreaEventFC"             
[7] "NHDLineEventFC"              "NHDPointEventFC"             "WBDLine"                    
[10] "NonContributingDrainageArea" "NWISBoundary"                "NWISDrainageArea"           
[13] "WBDHU14"                     "WBDHU8"                      "WBDHU2"                     
[16] "WBDHU4"                      "WBDHU6"                      "WBDHU10"                    
[19] "WBDHU12"                     "WBDHU16"                     "HYDRO_NET_Junctions" 

Why the difference? Specifically I am looking for: Layer name: NHDWaterbody.

R version 3.2.0. OSX v.10.10.3

  • When you say "others get" are they using the same R and rgdal versions and are you sure it's the same data source? – mdsumner Jun 30 '15 at 0:03
  • Same data source. Not sure what versions unfortunately. Opening the files in ArcGIS, there are more than 21 feature classes. I'm not understanding why in both cases the output is limited to 21, and different ones based (presumably) on software versions/drivers. – habd Jun 30 '15 at 14:11
  • I reckon the versions are the key here, and it may even be different systems. When you start library(rgdal) it prints out what is required, and sessionInfo() completes the story (though devtools::session_info() is much better). – mdsumner Jun 30 '15 at 22:10

Your Answer

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

Browse other questions tagged or ask your own question.