I have some polylines (streets on a map) take these three, for instance:
I need to convert these polylines into polygons. The mapping library I'm using has a built in convex hull function which generates something like this:
As you can see, using a convex hull to generate the area borders creates unwanted overlapping.
What I need is to create a convex hull that sort of avoids adjacent lines, like this:
There doesn't appear to be any built in method for doing this, so I'm going to have to get my hands dirty and write one myself. Problem is, I have no idea where to start.
Any information to help get me started is appreciated. If someone could walk me thru the algorithm that would be even better. If there is a name for this algorithm please let me know so I can start searching.



I was hoping for a more efficient implementation, but my "brute force" method isn't as bad as I expected (so far).
I've got a mostly complete implementation that follows these general steps:
Still working on Step three. I know there will gotchas but I'm working thru them. I'll update this answer once I get it all figured out.
Here's a quick n dirty Javascript/canvas implementation (first revision) to test the concept as I work thru it.
edit
Got this working on all my test cases, time to try with real data.. my solution for step three is..
Quick n dirty JS implementation (revision 2)
I'll mark the answer if no gives me a better one once I confirm it works on real data...