# Convert line to Polygon

Hi,
I am trying to create a polygon from a line. In my example, I have all the points(node) I need for an area based on a Tag in OSM.
However, there is no width information. I can plot a line along the path. I know that path is 10 feet wide. How can I convert into a polygon given the line and the constant width? If it is a straight path, I can use the bearing and do the GPSMath to find the four corners and draw a rectangle. But the shapes I am interested, are not always a straight line.

Thanks.

Firstly, you wouldn’t normally want to do this on the map itself, as you lose information about direction.

Secondly, if you intend to overlay it onto map tiles, you should note that, over small areas, the projection preserves angles. As such you can work out the width in pixels and then use simple coordinate geometry to define points displaced by half the width, perpendicularly from the ends of every line segment. You can project these lines and solve for each intersection, which should be simple, linear simultaneous equations.

This is probably the only sensible thing to do on the concave side. On the convex side, you coyld either do this, which will over state the width, or you could introduce an extra segment, to fill the gap, which will under state the width.

I would’nt draw it as a polygon, but just add width=10’ tho the line.