title: intersect stacked images R
body: <p>I downloaded 50 <strong>landsat 8</strong> images and extracted them in a subfolder Landsat8</p>
  
  <p>By iterating through the list of folders containing the images I extracted 2 bands to calculate a vegetation index (LSWI) with a function created and called <strong>calcIndex</strong>: </p>
  
  <pre><code>for(scene in folders){
   NIR &lt;- raster(b5.tif)
   SWIR1 &lt;- raster(b6.tif)
  
   LSWI &lt;- overlay(x=nir, y=SWIR1, fun=calcIndex)
   writeraster(LSWI, filename=LSWIxxx.tif, format='GTiff', datatype = 'FLT4s')
  }
  </code></pre>
  
  <p>This all works, I can access all the LSWI.tiff files and import them in ArcGIS for example. My problem is related to stacking (or brick) them and using the stacked file for analysis. </p>
  
  <p>I selected all the LSWI.tif files in a list and stacked that list:</p>
  
  <pre><code>LSWI_list &lt;- list.files(full.names = TRUE, recursive = TRUE, pattern = "LSWI.tif$") 
  LSWI_stack &lt;- stack(LSWI_list, quick = TRUE)
  </code></pre>
  
  <p>I used quick = TRUE here to assure the stacking works despite different extents of the images. Now I want to use intersect to find the largest common area of all the images and crop all images on the resulting extent, <strong>can somebody explain to me how to use the intersect function on a large stacked list of images?</strong> I want to for example sum all the images up, which I think only works if all the extents are equal.</p>
  
  <p>On top of that I would like to access one particulair location (coordinate system WGS84, units in meters is assigned automatically) and derive <strong>all</strong> LSWI values form the images of that particular location.</p>
  
  <p>Hopefully I made my challenges clear. 
  Thanks!</p>