Jump to content

 
Photo

Smoothing in Illustrator

- - - - -

  • Please log in to reply
21 replies to this topic

#1
Charles Syrett

Charles Syrett

    Ultimate Contributor

  • Validated Member
  • PipPipPipPipPipPip
  • 537 posts
  • Canada

I've imported some shapefiles into Illustrator, and I'm trying to find a way to smooth all the lines by specifying point handles, the way I've always done in FreeHand (using Pat Dunlavey's most excellent Smooth tool). The Smooth function built into AI seems to be more like the Simplify function in FreeHand. Is there something I'm missing here? Maybe another third-party plug-in?


Charles Syrett
Map Graphics
http://www.mapgraphics.com

#2
patdunlavey

patdunlavey

    Contributor

  • Validated Member
  • PipPip
  • 27 posts
  • United States

Thanks for the shout-out Charles! I had completely forgotten about that smooth tool that I paid a guy to create lo these many years ago. Doesn't seem like it would be terribly difficult to figure out how to write a script to do the same in Illustrator, though I'm guessing it would run quite slow at best.

Of course, you could always run the smooth operation in Freehand, and then move the file into Illustrator...
Pat Dunlavey
www.pdcarto.com

#3
ProMapper

ProMapper

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 216 posts
  • Gender:Female
  • Location:India
  • Interests:promapper@gmail.com
  • India

I have found that the smoothing done by http://www.mapshaper.org/ is really fantastic. The algorithm is great as it retains most of the shapes by thinning out redundant points. But it does it on the shp file. However it gives an eps output too. One can view the resulting shp file but the limiting factor is 16mb for the shp file.

Anu
http://www.mapsandlocations.com

#4
Charles Syrett

Charles Syrett

    Ultimate Contributor

  • Validated Member
  • PipPipPipPipPipPip
  • 537 posts
  • Canada

Certainly I could loop through Freehand -- but I'm using MAPublisher In Illustrator, so when I bring the lines back in they'll lose their geo-smarts.... :(


Charles Syrett
Map Graphics
http://www.mapgraphics.com


Thanks for the shout-out Charles! I had completely forgotten about that smooth tool that I paid a guy to create lo these many years ago. Doesn't seem like it would be terribly difficult to figure out how to write a script to do the same in Illustrator, though I'm guessing it would run quite slow at best.

Of course, you could always run the smooth operation in Freehand, and then move the file into Illustrator...



#5
Charles Syrett

Charles Syrett

    Ultimate Contributor

  • Validated Member
  • PipPipPipPipPipPip
  • 537 posts
  • Canada

Yes indeed, I LOVE Mapshaper.....but I'm looking for a solution in Illustrator / MAPublisher. Even a Mapshaper-smoothed line will come into Illustrator without Beziers.


Charles Syrett
Map Graphics
http://www.mapgraphics.com

I have found that the smoothing done by http://www.mapshaper.org/ is really fantastic. The algorithm is great as it retains most of the shapes by thinning out redundant points. But it does it on the shp file. However it gives an eps output too. One can view the resulting shp file but the limiting factor is 16mb for the shp file.

Anu
http://www.mapsandlocations.com



#6
Andrew Patterson

Andrew Patterson

    Key Contributor

  • Validated Member
  • PipPipPip
  • 99 posts
  • Gender:Male
  • Location:Toronto, ON
  • Canada

Yes indeed, I LOVE Mapshaper.....but I'm looking for a solution in Illustrator / MAPublisher. Even a Mapshaper-smoothed line will come into Illustrator without Beziers.


Actually, we liked Mapshaper too -- that's why we consulted with the author when we re-wrote the MAPublisher Simplify Lines tool for 8.0 :) The 8.0+ Simplify Lines maintains topology in the same manner, preserving common vertices between adjoining polygons.

It does a pretty stellar job, while still preserving the shape of your features -- a nice improvement over the old Simplify Lines!
Andrew Patterson
Lead Software Architect
Avenza Systems Inc.

email: andrew@avenza.com
phone: 416.487.5116

#7
Charles Syrett

Charles Syrett

    Ultimate Contributor

  • Validated Member
  • PipPipPipPipPipPip
  • 537 posts
  • Canada

You know, I was just starting to think that this is something that should be part of MAPublisher -- and then you wrote your reply. B)

Now: does it go the other way as well? In Pat Dunlavey's (most excellent) Smooth Xtra, you could also remove all bezier handles. I do this frequently when someone wants my FreeHand contours in CAD, without having a bloated file with far too many vertices. I select all the lines, use FreeHand's "Add Points" Xtra to add some extra points (please don't tell me Illustrator doesn't have that either), then use the Smooth tool to eliminate all handles. Voila -- ready for export to DWG.

So.....how about it? Or shall I just stay with FreeHand a little longer until Illustator gets up to speed? ;)


Charles Syrett
Map Graphics
http://www.mapgraphics.com

Actually, we liked Mapshaper too -- that's why we consulted with the author when we re-wrote the MAPublisher Simplify Lines tool for 8.0 :) The 8.0+ Simplify Lines maintains topology in the same manner, preserving common vertices between adjoining polygons.

It does a pretty stellar job, while still preserving the shape of your features -- a nice improvement over the old Simplify Lines!



#8
Garvan

Garvan

    Contributor

  • Validated Member
  • PipPip
  • 12 posts
  • Location:Toronto
  • Canada

Try this for turning a bezier to a non-bezier vertex:
Object > Path > Simplify, turn on options Straight Lines, and set the Angle Threshold to zero.

However, you would have to have interpolate vertices by hand, I don't see how to do this in Illustrator automatically. We actually have code internally that interpolates beziers to a non-bezier line, for functions that don't work on beziers.

Now: does it go the other way as well? In Pat Dunlavey's (most excellent) Smooth Xtra, you could also remove all bezier handles. I do this frequently when someone wants my FreeHand contours in CAD, without having a bloated file with far too many vertices. I select all the lines, use FreeHand's "Add Points" Xtra to add some extra points (please don't tell me Illustrator doesn't have that either), then use the Smooth tool to eliminate all handles. Voila -- ready for export to DWG


Garvan Keeley
Software Development Manager
Avenza Systems Inc.

#9
Charles Syrett

Charles Syrett

    Ultimate Contributor

  • Validated Member
  • PipPipPipPipPipPip
  • 537 posts
  • Canada

Thanks for your reply, Garvan.

I'm still trying to understand why the functionality I've described (as per Pat's Smooth Tool) wasn't already developed years ago. I don't do a lot of work in GIS, but when I do, the most-often-done task is this matter of non-bezier to bezier, and vice versa. That's basic -- it's an essential part of going back and forth between GIS/CAD and Illustration software. Pat's tool is extremely simple and gives the user complete control over the process.

If such functionality (including adding points) doesn't exist in Illustrator, and if most cartographers are using Illustrator, then how do you all add bezier curves to your work? And how do you remove them when you want to export to GIS or CAD? After all, the only alternative would be jerky lines and bloated file sizes.

Is there something I'm missing here? :huh:


Charles Syrett
Map Graphics
http://www.mapgraphics.com


[quote name='Garvan' date='Mar 2 2009, 08:39 AM' post='22815']
Try this for turning a bezier to a non-bezier vertex:
Object > Path > Simplify, turn on options Straight Lines, and set the Angle Threshold to zero.

However, you would have to have interpolate vertices by hand, I don't see how to do this in Illustrator automatically. We actually have code internally that interpolates beziers to a non-bezier line, for functions that don't work on beziers.

#10
Andrew Patterson

Andrew Patterson

    Key Contributor

  • Validated Member
  • PipPipPip
  • 99 posts
  • Gender:Male
  • Location:Toronto, ON
  • Canada

I might be misunderstanding, but if you're just asking if Illustrator can convert back & forth between bezier & non-bezier, it certainly has that capability. Object > Path > Simplify... will let you do that in either direction. By default it will simplify to bezier, but if you selected a bezier line and check 'Straight Lines', you'd be going in the other direction. After that, it's simply a matter of picking the amount of simplification using the Angle threshold -- zero being "Don't touch it!" :) If you're going to bezier, then you'd also need to specify the 'Curve Precision' to give Illustrator an idea of how closely a curve should match the straight lines its replacing. Again, choosing 100% for that and 0% for the Angle Threshold should do a pretty straight non-bezier to bezier conversion.

As for what gets used where in our code, I'd have to check. I'm pretty sure we automatically convert beziers into non-beziers when exporting when a format doesn't support beziers. For importing though, I had to ask my colleague here who wrote the Import interface and he thinks it currently always vectorizes bezier when reading them. I think only DGN & DXF have the capability to have curved, bezier-like) lines so it doesn't impact many formats. Asking him, he also said we could probably add an option to leave them as bezier (which given how those formats define their curves would be a close approximation anyways) but no one has really asked for that.

I do know that the conversion of beziers to non-beziers & vice versa is available to us in the Illustrator SDK though. I think we do vectorization ourselves in reading & writing, but use Illustrator's for Simplify Lines. Don't quote me on that though, I'd have to actually pore over the code to know for sure!
Andrew Patterson
Lead Software Architect
Avenza Systems Inc.

email: andrew@avenza.com
phone: 416.487.5116

#11
Charles Syrett

Charles Syrett

    Ultimate Contributor

  • Validated Member
  • PipPipPipPipPipPip
  • 537 posts
  • Canada

Close, but no cigar. The idea is to keep all the points -- just pull handles out of each one to a specified distance from the original line. I've played with Illustrator's Smooth tool, but it always deletes points and badly distorts the original line, no matter how small the settings.

But there's good news -- Illustrator does have an add anchor points tool! There it is, right under Object>Path! Somehow I missed that before. So the export should be fine, but I'll still have to loop through FreeHand and Pat's (most excellent) Smooth tool for the imports.


Charles Syrett
Map Graphics
http://www.mapgraphics.com

I might be misunderstanding, but if you're just asking if Illustrator can convert back & forth between bezier & non-bezier, it certainly has that capability. Object > Path > Simplify... will let you do that in either direction. By default it will simplify to bezier, but if you selected a bezier line and check 'Straight Lines', you'd be going in the other direction. After that, it's simply a matter of picking the amount of simplification using the Angle threshold -- zero being "Don't touch it!" :) If you're going to bezier, then you'd also need to specify the 'Curve Precision' to give Illustrator an idea of how closely a curve should match the straight lines its replacing. Again, choosing 100% for that and 0% for the Angle Threshold should do a pretty straight non-bezier to bezier conversion.

As for what gets used where in our code, I'd have to check. I'm pretty sure we automatically convert beziers into non-beziers when exporting when a format doesn't support beziers. For importing though, I had to ask my colleague here who wrote the Import interface and he thinks it currently always vectorizes bezier when reading them. I think only DGN & DXF have the capability to have curved, bezier-like) lines so it doesn't impact many formats. Asking him, he also said we could probably add an option to leave them as bezier (which given how those formats define their curves would be a close approximation anyways) but no one has really asked for that.

I do know that the conversion of beziers to non-beziers & vice versa is available to us in the Illustrator SDK though. I think we do vectorization ourselves in reading & writing, but use Illustrator's for Simplify Lines. Don't quote me on that though, I'd have to actually pore over the code to know for sure!



#12
MapMedia

MapMedia

    Hall of Fame

  • Validated Member
  • PipPipPipPipPipPipPip
  • 1,029 posts
  • Gender:Male
  • Location:Davis, California
  • United States

ArcMap can do this: ArcTools generalize polygon or polyline, by removing set # of vertices. I use it a lot.

#13
Andrew Patterson

Andrew Patterson

    Key Contributor

  • Validated Member
  • PipPipPip
  • 99 posts
  • Gender:Male
  • Location:Toronto, ON
  • Canada

Close, but no cigar. The idea is to keep all the points -- just pull handles out of each one to a specified distance from the original line. I've played with Illustrator's Smooth tool, but it always deletes points and badly distorts the original line, no matter how small the settings.


Maybe it's terminology confusion on my part then -- what exactly do you mean by 'pull handles out'. Every path is technically a bezier in Illustrator, though if the in & out points for an anchor point are the same as the anchor point, that effectively behaves as a non-bezier point. Are you trying to take those in & out points and pull them along the line? Or are you trying to remove the in & out points to reduce it to a straight line? I think the former, but I'll admit I don't understand the value of it. Which isn't to say there isn't one (since, if that's right, you're doing it!) but rather that I'm simply ignorant!
Andrew Patterson
Lead Software Architect
Avenza Systems Inc.

email: andrew@avenza.com
phone: 416.487.5116

#14
frax

frax

    Hall of Fame

  • Associate Admin
  • PipPipPipPipPipPipPip
  • 2,309 posts
  • Gender:Male
  • Location:Stockholm, Sweden
  • Interests:music, hiking, friends, nature, photography, traveling. and maps!
  • Sweden

I often use the Simplify... function in Illy, with a setting of 97-99, and I am reasonably happy with the results.
Hugo Ahlenius
Nordpil - custom maps and GIS
http://nordpil.com/
Twitter

#15
Charles Syrett

Charles Syrett

    Ultimate Contributor

  • Validated Member
  • PipPipPipPipPipPip
  • 537 posts
  • Canada

To really understand this, read Pat's ReadMe: http://www.pdcarto.c...on/csreadme.txt
Better yet, download and try it: http://www.pdcarto.com/freehand.html
;)


Charles Syrett
Map Graphics
http://www.mapgraphics.com

Close, but no cigar. The idea is to keep all the points -- just pull handles out of each one to a specified distance from the original line. I've played with Illustrator's Smooth tool, but it always deletes points and badly distorts the original line, no matter how small the settings.


Maybe it's terminology confusion on my part then -- what exactly do you mean by 'pull handles out'. Every path is technically a bezier in Illustrator, though if the in & out points for an anchor point are the same as the anchor point, that effectively behaves as a non-bezier point. Are you trying to take those in & out points and pull them along the line? Or are you trying to remove the in & out points to reduce it to a straight line? I think the former, but I'll admit I don't understand the value of it. Which isn't to say there isn't one (since, if that's right, you're doing it!) but rather that I'm simply ignorant!






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

-->