6

I have a map with small circles for over 200 cities. I need to change all of the circles into map pins. Is there a way to do this? I think it's a script maybe.

I know how to select all objects of the same appearance and give them a new graphic style but that will only let me change the color, stroke, etc. not replace with a new shape.

2 Answers 2

8

Yes, this script exists, find and replace by nvkelso.

To use, make sure the pin (or object to replace with) is on top, select all to replace (including the pin) and run the script.

@joojaa also made a great point. If you make the pin a symbol, it will be very easy to make changes later on (which will apply to all of them).


If you use the centered one, it's pretty straightforward:

enter image description here


There's also the transform to fit one, which resizes it in order to fit it - which can potentially distort it:

If you do want them resized without being distorted, you simply need to add a circle around your pin and turn it into a clipping mask, this will keep it proportionate:

enter image description here


enter image description here

1
  • 3
    Yes best make the object you replaced with a symbol then its easy to change it later even without the script.
    – joojaa
    Commented Aug 24, 2018 at 5:44
2

You know, scripts and symbols are a good way to get a robust editable set of art mapped onto individual shapes in Illustrator. With symbols there's a high degree of editability available.

There's a round-about alternative which takes advantage of some Illustrator features to provide nearly the same functionality using Graphic Styles.

In Illustrator they let you capture arbitrary line-art and raster art in a couple different formats other than symbols: a pattern and brush. One of these can be used to map art to shapes, but which one & why not both?

Pattern fill fail

Of course it would be easy and useful for anyone to make a pattern consisting of the one bunch of art (the size of the intended shape to be filled) and then use this pattern fill to fill all desired circles. Unfortunately they do not make it easy because any shape in the document offset in its position from where the pattern fill gets its origin from, tiled, will have its pattern fill transformed not offset from the object's bounding box. So you get a pattern all wrong & chopped up on the document. Patterns do not adhere to shape bounding origin The problem is that unlike in this case, the map circles can be all over the place and not matched to a grid to which a pattern fill could also be matched.

The solution

is to use the other kind of art-storage method: the brush. A brush can store a limited amount of artwork compared to a pattern fill, no gradients are allowed, for example. Some gradient-like appearances can be approximated using expansion of gradient fills (Object > Expand) and also rasters can be used in brush art, so if this is satisfactory, then you're good to go to the next step. gradients not allowed

For my example I just made a brush using the rasterized copy of my line art.

What kind of brush?

The Pattern Brush. This brush type maintains a proportion and has a habit of having parts of it disappear if the path is too small to accommodate them, if the proper settings are used. Pattern Brush creation dialog This next part is going to take advantage of that along with other Illustrator appearance features.

Appearance Settings & Graphic Style use

The appearance settings are added to a circle which would be typical of the kind you will apply a graphic style to, in my case a circle 22x22pt.

1) Add the pattern brush stroke

  1. Add a stroke colored with the pattern brush you made.
  2. On that stroke, add the Convert to Shape (Rectangle) effect with the proper settings to ensure that there's only two, reflecting, instances of your intended symbol art. adding the convert-to-shape effect
  3. Add a transform effect to move the instance into proper position. adding transform to the pattern stroke

2) Block the extra instance

  1. Add a new fill of any color to the circle, it should fill the shape in completely, obscuring the centered brush element instance.
  2. Turn the opacity of this new fill to 0, and turn on the Knockout Group option in the object's main transparency options. adding a blocking fill which knocks out unwanted elements
  3. Add a transform effect to move the blocking shape upward to block off the brush element outside of the circle. enter image description here
  4. Now this is a style which can be saved as a graphic style and applied through a click.

Creating multiple brushes with the same settings and replacing this brush in the graphic style can allow you to swap the art in one click. The end-result

Any advantages to this?

If you are in a situation where the artwork limitation can be worked around or accepted for your needs, having graphic-style enabled art-mappings such as this could have its advantages in use with Illustrator actions. Since actions can apply a named style that exists in your document, this already could be used to process a batch of files of different maps and turn their circles into a "symbol" of choice. Even further, it could be used with variable data batch processing to even replace the 'symbol' with different kinds of styles based on the variable data - although this would be a topic unto itself.

Actions can apply a named style by its name

Your Answer

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

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