title: How to make a searchable Polygon map in R?
body: <p>I want to make a map of polygons in R.  I know all the vertices of the different polygons and know how to create polygons using:</p>
  
  <pre><code>library(sp)
  Polygonoutline1 &lt;- rbind(c(x1,y1),c(x2,y2),c(x3,y3))
  Polygonshape1 &lt;- Polygon(Polygonoutline1)
  Polygonoutline2 &lt;- rbind(c(x1,y1),c(x2,y2),c(x3,y3))
  Polygonshape2 &lt;- Polygon(Polygonoutline2)
  Polys1 &lt;- Polygons(list(Polygonshape1),"Shape 1")
  Polys2 &lt;- Polygons(list(Polygonshape2),"Shape 2")
  map &lt;- SpatialPolygons(list(Polys1,Polys2))
  plot(map) 
  </code></pre>
  
  <p>Now I want to be able to save (export) this plot and read it in to another R code algorithm where it can be searched i.e. I want to specify a point (xy coordinate) and want to know which polygon is at that point (i.e. "Shape 1" or "Shape 2".  How do I do this? In reality my map will have 6 or so polygons to search.</p>