title: Query openstreetmap data layer for use with R ggplot + sf
body: <p>I'm trying to figure out how to re-plot the vector data from openstreetmaps using <code>sf</code> and <code>ggplot2</code>. I know I can get a raster background using <code>ggmap</code>, but I'm hoping I can get a much higher quality plot by using the underlying vector data directly.</p>
  
  <p>Here is some code that get's me some site data.</p>
  
  <pre><code>map &lt;- get_map(location = bb, maptype = "toner", source = "stamen", zoom = 15)
  ggmap(map)
  </code></pre>
  
  <p>This produces:</p>
  
  <p><a href="https://i.stack.imgur.com/LP8QE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LP8QE.png" alt="generic ggmap site"></a></p>
  
  <p>Of course, I would like to get the same result using vector graphics. Here is a Overpass query that selects data from the same bounding box as above.</p>
  
  <pre><code>[out:xml][timeout:60];
  (
    node(38.0151865284475, -121.872227331133, 38.0340023660995, 121.829405993985);
    &lt;;
    &gt;;
  );
  out body;
  </code></pre>
  
  <p>Plugging that into the <a href="https://overpass-turbo.eu/#" rel="nofollow noreferrer">overpass API</a> seems to highlight a lot of data, but when I plot in R I see some weird looking stuff.</p>
  
  <pre><code>library(osmdata)
  q &lt;- "[out:xml][timeout:60];\n  (\n  node(38.0151865284475, -121.872227331133, 38.0340023660995, -121.829405993985);\n      &lt;;\n      &gt;;\n  );\n  out body;\n  "
  r &lt;- osmdata_sf(q)
  plot(r[["osm_multipolygons"]]["osm_id"])
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Ymqer.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ymqer.png" alt="OSM query results"></a></p>
  
  <p>I'm aiming to plot something that looks much like the original openstreetmap plotting view, but which only includes railroads, streets, bodies of water, buildings and wetlands. So, I need to figure out how to download everything that is contained within or touches the bounding box. Maybe nodes by itself can't get this information? Can I actually do what I want to <code>osmdata</code> or should I take a different approach?</p>