title: How to calculate Polygon points from a simple line for a specific width?
body: <p>I currently develop an application that creates polygons from lines and I experience a small problem:</p>
  
  <p>I have a set of points, representing a line. I would like to create a polygon that displays the line with a specific width (e.g. for a street). I have several ideas how to calculate the outer polygon points, but I think they are too complicated...</p>
  
  <p>My best idea was the one pictured below: Every point of the line must be projected to at least two points: Both points must be 90° to the following line segment and have a distance half of the preferred polygon width.</p>
  
  <p><img src="https://i.stack.imgur.com/kWm2J.png" alt="Highway rendering width problem"></p>
  
  <p>This works good, as you can see at the end and start points of the pictured polygon. Now the complicated part: With this method, at a corner, each point gets four points. But these points are not correct for the outer polygon, because they are in the shape. The lines intersected and created an ugly polygon.</p>
  
  <p>How can I find the correct points for such a polygon? I think my method is far too complicated for solving this problem.</p>
  
  <p>Can anybody help me with this (propably very common) problem?</p>
  
  <p><em>Info:</em> I tagged this with <code>openstreetmap</code> because renderer like Mapnik have this problem, too.</p>