4

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.

3
  • your data is a bunch of non connected lines i presume?
    – joojaa
    Aug 25, 2016 at 16:57
  • Could you post an image of what you have currently, and what you want it to look like (even if that means a "closed line" - just for our reference).
    – TCDesigner
    Aug 25, 2016 at 22:00
  • Sorry for taking some time. I thought I'd get replies in my inbox instantly, but stackexchange sends a digest. After working on the problem manually I found jooja's solution: the unwanted lines as a result of joins tend to stand out for their length and can be deleted after the join. Thank you for your answer and clarifications. For all the other respondents: manual join is no longer a reasonable option for 1000+ line segments. I was somewhat unclear out of unfamiliarity with AI. The problem arises from selecting all 1000+ lines and needing some parameters to specify when (not) to join. Aug 26, 2016 at 17:38

2 Answers 2

2

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.

0

The standard join function in Illustrator will do what you need. I'm slightly muddled about the distinction that you are making between joining and closing so I'll cover a few options. All of the following rely on first selecting the two ends of the paths that you wish to join with the direct selection tool (white arrow):

  1. Object > Path > Join (command-j) will add an extra segment of path between the two points to create the join.
  2. Object > Path > Average (command-alt-j) will move the two points together, but not join them so they will still be separate paths, but with a common position for their ends.
  3. Finally, I don't know where (or if) this option lives in a menu, but command-alt-shift-j will move the points together (like average) and then join them at that point. Nice and tidy and doesn't add any extra line segments which might mess up the aesthetics, especially for dashed lines.

Hopefully one of the above will work for you, none of them result in closed paths.

2
  • 1
    No, it does not work well if the user has multiple lines like a road network or river network that forks. An example of this is found in this post. See what happens is illustrator tries to connect 2 paths that are separated form each other. CAD/GIS applications frequently dump all data as small linear segments that are not connected together so being able to join a 100,000 lines is important, fixing manually would take days.
    – joojaa
    Aug 26, 2016 at 9:22
  • The users description is a bit bad. His data is a bit complex so he does not see that it deos not really close the path but still closes separate segments in a very undesirable manner.
    – joojaa
    Aug 26, 2016 at 9:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.