ThinkGeo.com    |     Documentation    |     Premium Support

How to display several lines that have the same coordinate side by side

Hi,

I didn’t find how to display several lines that have the same coordinates side by side, such as what we have on transportation map like this one https://www.ondea-bus.fr/sites/default/files/plan_urbain_2018-web-small-min.pdf

Could you give me sone hints ? Thanks !

Hi Judicael,

In your sample you can see the blue line is always keeps in one side of the red one, which means they should be two lines because the shape won’t be the same, we don’t have an API can generate the two lines based on one, if you have an algorithm for that you can build a function and implement by set the different styles to the two lines.

If you want to use offset to do that, the result will looks like this, I think that’s not what you need.
image

The other possible way is set outerPen, innerPen and centerPen to your linestyle, which maybe make the result looks like two lines with a border, it looks like:
image

I draw it like this:
layer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = new LineStyle(new GeoPen(GeoColors.Black, 10), new GeoPen(GeoColors.Yellow, 6), new GeoPen(GeoColors.Black, 2));

I tried to find an algorithm but hadn’t get a entire one, here is the links which be should helpful, it looks the way to do that is loop all vertex, calculate the inner or outer new vertex based on original one, then connect the new ones. You can also do some search about it based on the key words: “Parallel polyline” “polyline thickness” etc.



I hope that’s able to help you.

Regards,

Ethan