0

I would like to work with the USGS dataset PADUS in R. However the files are huge and I just want to plot out the main state and national forests, parks and protected areas. Does anyone have any suggestion on how to load and plot these very large files? USGS DATA DOWNLOAD

Normally I would use readOGR (rgdal) to load in the files but this just seems to crash or fail to load.

  • How big are the files / objects? What have you tried so far, and what issues are you experiencing? – Simbamangu Feb 2 '17 at 14:12
  • Convert to a spatial database format, then use a query to select what you want? – Spacedman Feb 2 '17 at 14:12
  • I downloaded the Rhode Island set from gapanalysis.usgs.gov/padus/data/download (111MB) because the whole things is 1.3GB. Now, using RI as an example, what do you want to select out of it? Which of the shapefiles, what condition on which attributes? – Spacedman Feb 2 '17 at 14:22
  • Normally I use readOGR to load in files but this just doesnt seem to work or take way too long to upload any of the files. – I Del Toro Feb 2 '17 at 14:22
  • @Spacedman I want to pull out the information on all terrestrial protected areas and make a basic map with the areas colored according to their protection status.I guess the problem is that I want the info for the entire country not just individual states – I Del Toro Feb 2 '17 at 14:24
2

Use "x <- sf::st_read" it's much faster than rgdal and will happily read much larger data sets.

When you plot it, be sure to use "plot (st_geometry(x))" first, since it will otherwise do a lot of repeated drawing for the default multi panel layout. It defaults to faceting on every column, up to some max.

Indexing with "[" works the same as with sp, so use that to plot just a few rows before trying the entire thing if it's really massive.

|improve this answer|||||
  • 1
    I'd still look into doing an ogr2ogr filter if all you need is a subsample of the original shapefile defined by some easy criterion. – Spacedman Feb 2 '17 at 14:35
  • 1
    I would do that if the R pathway failed. Sub-read is a good feature request for sf too. – mdsumner Feb 2 '17 at 14:39

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.