title: Get Country borders through openstreetmap API
body: <p>i want to draw a map of Europe. For that i need the country outlines as polygons. For that i want to use the openstreetmap API.</p>
  <p>I played around a bit with <code>overpy</code> but my result for a single country took 10 minutes to execute and doesn't look right (seems like the ways do not fit together).</p>
  <p>My code so far:</p>
  <pre><code>import matplotlib.pyplot as plt
  
  import overpy
  api = overpy.Overpass()
  
  result=api.query(&quot;area['name:en'='Denmark']-&gt;.country;rel['name:en'='Denmark']['type'='boundary']['admin_level'='2'];(way(r)['maritime' != 'yes'](40,-10,70,80);way(area.country)['natural'='coastline'](40,-10,70,80););out geom;&quot;)
  
  x=[]
  y=[]
  i=0
  for way in result.ways:
      print(f&quot;way {i} of {len(result.ways)}&quot;)
      i=i+1
      for node in way.get_nodes(True):
          x.append(float(node.lon))
          y.append(float(node.lat))
  plt.plot(x, y,label=str(way.id))
  plt.show()
  </code></pre>
  <p>Am i on the right track or is there a way better solution? Thanks!</p>
  <p><a href="https://i.stack.imgur.com/sLdIM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sLdIM.png" alt="matplotliboutput" /></a></p>
  <p><a href="https://i.stack.imgur.com/YSOpl.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YSOpl.gif" alt="example map" /></a></p>