Advertisement


Illustrator CC: how to join lines without closing?


Question

I'm a map-maker working with line information for roads, railways and other network data. I make my maps pretty with Illustrator, but I am running into a problem, a combination of two aspects:

  1. The data I am using consists of many line fragments. This is common in GIS-data. I want to mark the information with a dashed line, which means I need to join the line for aesthetic presentation.

  2. For most designers the goal seems to be to close shapes, but I precisely want to keep my lines "open", or I run the risk of drawing streets and rivers that don't exist just to close the shape.

Does anyone have a suggestion for how to join lines that overlap or are near one another without closing any line?

I've tried a couple of options now including the toolbox with scripts by Hiroyuki Sato (I think: the one including metaball), but they all close lines I want to keep open.

2016/08/26
1
4
8/26/2016 8:07:00 AM

Accepted Answer

The default join is indeed a bit over aggressive for this kind of import use as it does not have any merge distance option.

This is possible to script or program with the plugin api. Its a bit tedious as illustrator scripting API is very low level when it comes to Bézier data. However, there is more to consider than just joining such as how to handle forks in the path and overlapping data.

enter image description here

Image 1: How do you handle joins so that offsets match.

So there are many implementation details to consider beyond just merging close points and ignoring the forked neighboring paths.

I am currently a but short on time so I can not script this for you, even tough I've needed this same thing occasionally when dealing with CAD/GIS/3D Render Files. It should not be impossibly hard for a developer to actually do this, but i am not aware of anybody who has done this implementation in way that would work out for you. This is on my list of things to do however but I'm a bit skeptical whether I will ever have time to go that far down the list unless this becomes a weekly issue for me personally. I would say that it is a 1-2 workdays task to program this.

However, there might be a shortcut for doing this. It is possible to circumvent the problem if your data consists of short spans. The extra joining lines tend to be much longer than your initial data segments. So you could instead join with the builtin join tool, then select spans that are longer than a certain value and delete them. This would be much faster to implement as you wouldn't need to build acceleration structures direction checking etc etc.

enter image description here

Image 2: Alternative, even if somewhat inferior method.

Though obviously this is inferior as it can get errors in the result as some join spans can certainly be short. However this trick only works if your data is made out of smaller segments so not a suitable solution for all cases. Asw you did not answer my comment i can not know if this helps you or not so I wont invest time in scripting it.

enter image description here

Image 3: Result of trick and dashes.

2017/04/13
2
4/13/2017 1:00:00 PM