I have to read in a small portion of a huge ESRI shapefile in R. I am doing this in two steps:
Step 1: I use ogr2ogr
to clip the shapefile to my bounding box:
ogr2ogr -clipsrc xMin yMin xMax yMax outfile.shp infile.shp
Step 2: I read this into R with rgdal
:
df = readOGR(dsn="/path", layer="outfile")
The problem is that I have to do this for multiple files, and it's hard to keep track of the OGR
operations which generated each of these separate files. Is there any way to pipe ogr2ogr
in R, so that step 1 is done on the fly?