title: OSM - Boundary Export from XML file
body: <p>I've been attempting to export boundary information from an OSM file.  My process is nearly there however I have an issue with the polygon I'm generating drawing random lines.  </p>
  
  <p>I would appreciate some insight on where I may be going wrong.</p>
  
  <p>Step 1: Export the OSM data into XML</p>
  
  <pre><code>osmfilter -v greater-london-latest.osm --keep="boundary= admin_level= place="  &gt; b.txt
  </code></pre>
  
  <p>Step 2: Run a script to process the XML.</p>
  
  <pre><code>cycle each relation node
   load the member ways
     load the nodes from each specified way
      record the lat/lon and build a poly set
  </code></pre>
  
  <p>This produces a series of lat/lon which when I build them as a polygon give the correct overall shape I'm looking for.  However, there are issues with the connecting lines I assume..</p>
  
  <p><a href="http://i.stack.imgur.com/oAIOd.png" rel="nofollow">My polygon output</a></p>
  
  <p>I'm actually looking for this, which is similar but Im obviously missing something.</p>
  
  <p><a href="http://i.stack.imgur.com/a10Mh.png" rel="nofollow">Actual Poly Im looking to generate</a></p>
  
  <p>Again, thanks for any help.</p>