[Editor's note: Making the GIS > Illustrator > Flash workflow a 30 minute process instead of a 30 hour slog. Thanks Sebastian!]
Ken Hawkins, formerly of The Post and Courier newspaper (Charleston, SC) helped me figure out how to take GIS shapefile data (point, line, and polygon) prepped in ArcMap or similar, process it in Illustrator using the Avenza MaPublisher plugin, and then copy-paste import into Flash CS3+ and apply the Instance_setMcName script. I first saw his handywork in the http://www.charleston.net/graphics/200802_primary/ map which is illustrated at the top of this post. I first learned of this technique last year but I think it is still relevant so am posting it now.
Ken had help from Len De Groot over at newsartists.org ( http://www.newsartists.org/forums/showthread.php?p=41780, registration required). I have reformatted and edited Ken and Len’s instructions below.
- A shapefile,
- Illustrator CS3,
- MaPublisher (Illustrator plugin),
- Flash CS3, and
- Free command script called “Instance_setMcName”. Before you start, download the script from Adobe, registration required (alternate download, no registration required) and double click file icon to install the script into Flash. Relaunch Flash to enable the script.
- Shapefile prep work in ArcMap GIS as needed.
- Import the shapefile (.shp) in Illustrator using MaPublisher. Each geographic feature imports as it’s own path object in illustrator, visible in the Layers panel when it is set to not just show top level layers.
- Use MaPublisher to name each map object’s GIS database attribute to name itself.
- Import the Illustrator file to Flash .
- Run the script to take the movieclip names and apply them to instances.
- Shapefile prep work in ArcMap as needed.
- Open your GIS shapefile in Illustrator via the MaPublisher plugin (File > Import Map Data).
- Edit > Select All the imported map path objects.
- Open the MapAttributes panel by going to View > MaPublisher > MapAttributes.
- In your MapAttributes panel, use the flyout menu to select Edit Schema.
- Select the #Name (usually selected by default) in the list of columns.
- Check the box marked “Derive value from expression”
- Click the “…” button.
- In the resulting dialog’s text entry field, type in the name of the field you want to use to name the individual polygons (county, precinct, etc.). This is case sensitive.
- Hit OK twice.
- Watch as your individual path objects are named in the Layers panel then save the file.
- Open Flash and import the AI file to the stage (File > Import).
- In the Import dialog box, select all the sublayers and check the box named “Create movie clip” and hit OK. The map will be imported both onto the stage and each map object will be added to the document’s Library.
- In the Library panel, select all the MovieClips in the Illustrator Import sub-folder and drag them up and out of the folders to the top level.
- Use Edit > Select All to select all your map object symbols on the stage.
- Under “Commands” in the top menu, select “Instance_setMcName.”
- All you symbol instances will be named the same as their parent movieClip libary item. Use the Properties panel to verify this.
Both Ken and I have used this process on multiple shapefiles with hundreds of objects and it’s worked like a dream.
Caution on Numeric Names:
Some GIS shapefiles have category names that begin with numbers, which Flash doesn’t like. Flash is picky about some other characters starting off the name, too, so when in doubt, use the following solution.
You can edit the schema to add a letter in front of each name and then use actionscript to do the same to each item in your XML file. A little cloogy but better than the alternative.
- Click the Add button in the Edit Schema window in MaPublisher’s Illustrator panel
- Name the new column “a”. Make sure the Type is string and enter “a” for the value (the derive value button must be unchecked to see this option).
- Press enter.
- Select #Name column.
- Find the expression field in the same dialog and type out “a&PRECINCT” (where “a” is the “a” attribute column name and PRECINCT is the attribute column name). Note: the & symbol is used to concatenate (add together) the string values in each attribute column.
- Press enter.
- Verify the name changes in the Layers panel.
Seperate Stroke and Fill Workflow:
To have a seperate stroke layer on polygons so the fills can be color coded seperately from the strokes (which would always maintain the same stroke color) you’ll need to make a 2nd copy of the symbols:
- In Illustrator after you’ve used MaPublisher to name all your polygons appropriately, duplicate the layer and hide/lock the original layer.
- Give the new polygons a stoke and no fill, and rename them using Steps 3-6 except append the naming scheme with “Stroke”
- Import the Illustrator file to Flash. Two groups of symbols are imported.One group’s symbols will be named something like “precinct234″ and the other group’s corresponding symbols will be named “precinct234Stroke”
- Flash can now be instructed via ActionScript coding to independently control a symbols fill and whether or not it is “highlighted” with a stroke.
Use MaPublisher to import other GIS layers (roads, polling locations, etc.) and they will land directly on top of the thematic symbols. I recommend doing this in the same import session, or before you rescale the maps. Best results when all GIS shapefiles are already in the same projection.
To set up your XML which is used to import your map data values (essentially an XML version of your DBF file associated with the shapefile), check out Layne’s thread.