Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5984861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:26:30+00:00 2026-05-22T22:26:30+00:00

I currently develop an application that creates polygons from lines and I experience a

  • 0

I currently develop an application that creates polygons from lines and I experience a small problem:

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…

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.

Highway rendering width problem

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.

How can I find the correct points for such a polygon? I think my method is far too complicated for solving this problem.

Can anybody help me with this (propably very common) problem?

Info: I tagged this with openstreetmap because renderer like Mapnik have this problem, too.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:26:31+00:00Added an answer on May 22, 2026 at 10:26 pm

    What you are looking for is a polygon (or line) offsetting algorithm. This is not necessarily an easy problem to solve, by the way: An algorithm for inflating/deflating (offsetting, buffering) polygons.

    For the last couple of weeks I’ve been working on a line offsetting algorithm for Maperitive. In my case I only needed to offset the line so I wasn’t looking for a solution to create a buffered polygon around it, but I guess the algorithm could be extended further in the future:
    enter image description here

    Basic flow (roughly, but the devil is in the details):

    1. For each polyline point find a point that has an L distance from the original point and lies on a line that’s orthogonal to the original line and goes through the original point.
    2. Now draw an offset line through that new point. The line must be parallel to the original line.
    3. For corner angles you must extend the two neighbouring offset lines and find the intersection point, which will be the next point of the offset line.

    Some things to observe:

    • Notice the miter limit applied on concave angles to the right of the picture.
    • Before calculating the offset line you need to simplify the original polyline to exclude segments that are too small to hold the offset (the results can be seen at the center left of the picture).
    • I only implemented support for miter joins, but a good algorithm should be able to render round joins, too (using arcs).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are currently using SVN to develop an internal application that has most of
In the project I am currently working on, we have the need to develop
I've previously done WF workflows hosted by SharePoint sites. We currently have to develop
I am currently working on a VB.NET desktop application that uses .mdb (Access) database
I am currently developing a charting application (for the iPhone, although that is largely
Currently we have many applications, where each application has its own error notification and
I currently have hostingrails.com. But following their tutorial on deploying rails application with FASTCGI
we are using django to develop a customer-management application, and we need to set
I want to develop a application on Android platform to connect to salesforce. From
I want to develop an application where i want to free memory from other

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.