title: Why is an intersection of two shapefiles done in R not the same as an intersection done in ArcGIS?
body: <p>First I installed packages and such and set the working directory (example given)… </p>
  
  <pre><code>library(rgdal)
  library(rgeos)
  library(raster)
  library(maptools)
  
  setwd("V:/Water/GIS/"Shapefiles Intersected in R")
  </code></pre>
  
  <p>Then I read in shapefiles from computer folder - they are both of different polygon shapes of areas in NJ – example file pathways</p>
  
  <pre><code>munis &lt;- readOGR("V:/water/GIS/Shapefiles to Intersect in RStudio/municipalities.shp", "municipalities")
  
  streamsheds &lt;- readOGR("V:/water/GIS/Shapefiles to Intersect in RStudio /streamsheds.shp", "streamsheds")
  </code></pre>
  
  <p>Then I intersect both shapefiles</p>
  
  <pre><code>munistreamsRInt &lt;-intersect(munis,streamsheds)
  </code></pre>
  
  <p>Then I save the shp and view them in ArcGIS</p>
  
  <pre><code>writeOGR(obj=munistreamsRInt, dsn="Shapefiles Intersected in R", layer="munistreamsRInt", driver="ESRI Shapefile")
  </code></pre>
  
  <p>I used the same shapefile “munis” to intersect 4 different times with different shapefiles each time. So I did 4 different intersections.  I did each intersection in R as well as in ArcGIS to compare.  If “streamsheds” is shapefile 1, I did intersections between the following shapefiles: </p>
  
  <ul>
  <li>Munis and shapefile 1</li>
  <li>Munis and shapefile 2</li>
  <li>Munis and shapefile 3</li>
  <li>Munis and shapefile 4</li>
  </ul>
  
  <p>The intersection with shapefile 1 was a perfect match visually, both the intersection in  R and in ArcGIS were exactly the same when viewed. The attribute table data matched only after taking an additional step using the dissolve tool on the resulting shapefile of the intersection done in ArcGIS  (afterwards both have 1497 rows). </p>
  
  <p>The intersection with shapefile 2 done in R matched the intersect done in ArcGIS exactly. Both visually and in the attribute table. Without needing to use the Dissolve tool when doing it in ArcGIS. </p>
  
  <p>The intersection with shapefile 3 and the intersection with shapefile 4 done in ArcGIS were not perfectly matched with the intersections in R even after I tried using the Intersect and Dissolve tools. Majority of the results are the same, except for a few differences in each: </p>
  
  <p>The results of Munis and shapefile 3 done in R have 364 rows in the attribute table, and the one done in ArcGIS have 368 rows in the attribute table. The shapefiles intersected in R are missing 3 polygon shapes which can be seen in the ArcGIS intersected and dissolved shapefiles.  </p>
  
  <p>The results of Munis and shapefile 4 done in R have 944 rows in the attribute table, and the one done in ArcGIS have 943 rows in the attribute table. The resulting shapefile in R is missing 2 polygon shapes in the map (which can be seen in the ArcGIS shapefile) and the resulting shapefile in ArcGIS is also missing a different two shapefiles (which can be found in the R shapefile). </p>
  
  <p>Anyone know what might be the issue and how to fix it? Thank you. </p>