Archive for the ‘scripting’ Category

MarkerClusterer in an All New Flavor – ActionScript! (GoogleGeoDev)

Friday, August 14th, 2009

[Editor's note: An AS3 Flash / Flex library for auto-clustering near map location markers into groups symbols. This speeds map rendering and groups points all within the same neighborhood, avoiding "red dot fever" marker overload. An AS3 implementation of existing JavaScript extension. Still needs to account for geographic region clustering (not just within a grid). Thanks Laris!]

Republished from Google Geo Developer Blog.
Monday, July 27, 200. 

My name is XIAO Juguang – just call me Juguang. I am a freelance software developer based in Beijing, China. Technically speaking, I’m double sided. On one side, I specialize in knowledge management and business modeling, traditionally using LAMP and now experimenting with offerings like Google App Engine. On the other side, I love visualization in time and space, with charts, trees, graphs, and maps, always using the power of ActionScript/Flex, with the help of open-source projects like Degrafa, Axiis, and Birdeye, and of course, APIs like the Google Maps API for Flash.

A few month ago, Xiaoxi Wu (also from China!) created the MarkerClusterer library for the Google Maps JavaScript API v2 and released it in their open source utility library. This library did automatic clustering of markers placed on a map, so that a large amount of markers wouldn’t overcrowd the map or overwhelm the user. This is a great technique for having a better performing map (see this talk for more tips on improving map performance), and the Flash map community immediately rushed to port the code to ActionScript. Developer Sean Toru posted the first port, a version that was only Flash-compatible, Ian Watkins modified that port to use Flex packages, and then I refactored the code to be more ActionScript-friendly and released it into the open-source library. It’s great when random strangers can collaborate together on a common code goal. :)

To see how the AS3 MarkerClusterer works, try out the demo (shown above). As you zoom and pan the map, you can witness how the markers are clustered and re-clustered. To learn how to use MarkerClusterer on your own map, view the source code of the demo. To use the library, check out the source code and import it into your project.

The current algorithm is quite simple, just clustering markers in a grid and using static images for the cluster markers. Future extensions could include support for regional clustering or using arbitrary DisplayObjects for the cluster markers. If you’re interested in extending the library, join the project.

Simple shapefile drawing in ActionScript 3 (Cartogrammar)

Wednesday, July 29th, 2009

Shapefile + magic = map in Flash!

[Editor's note: Andy Woodruff explains how to use his quick and easy implementation of Edwin van Rijkom's AS3 classes for loading SHP files and their DBF attributes into Flash/Flex. This library DOES NOT PROJECT your shp files, you might consider doing that first.]

Recently I’ve heard two friends independently inquire about some sort of basic guide for loading and drawing a shapefile in Flash. The only real tutorial/example I can recall is here, dealing with Google Maps. But these guys are looking for something more bare-bones. Being a regular user of Edwin van Rijkom’s invaluable code libraries for reading shapefiles, and usually forgetting the process myself, I thought it would be a good idea to put together a very simple set of AS3 classes that load a shapefile and throw a map on screen.

So to get those jerks off my back, I wrote a little thing called ShpMap, which supplements van Rijkom’s classes by loading and drawing a shapefile. It’s nothing fancier than that. Sometimes all you need is to get your base map on screen. (Update: just to round it out a little more, I’ve added basic loading and parsing of a shapefile’s accompanying DBF file, which contains attribute data. This also uses classes by van Rijkom.)

I hope that this class (and the several associated classes) can both be directly usable for some projects and serve as a basic guide to using van Rijkom’s classes to load shapefiles.

Dig it:

  • An example that loads and displays a US states shapefile (and then puts a square on my house and colors the state of Wisconsin green). View the source code here.
  • Download the source code. (My classes plus van Rijkom’s, as well as a demo US States shapefile.)

PatchPanel: Flash Panels for Multiple CS Applications (Adobe)

Thursday, June 18th, 2009

adobedevconnection

[Editor's Note: ]

Republished from Adobe Developer Connection.

By Dr. Woohoo @ blog.drwoohoo.com.

Follow along with this tutorial to expand on what we created in the previous tutorial, PatchPanel: Integrating your ExtendScript, with the objective of using a framework that embraces running our Flash plug-in in multiple Creative Suite applications (Photoshop and Illustrator). When we are done, our Flash plug-in will work in all three CS applications using code that is appropriate for each host application― keeping in mind that this is necessary due to the differences in the DOMs of each application.

Our Flash plug-in will get the RGB values of the foreground color of the host CS4 application. You will integrate a separate ActionScript file for each host application within the Flash plug-in that you develop within a Flex Builder MXML project using the PatchPanel SWC library as the mechanism for communicating between your SWF and the host application, which will dynamically be defined in this example.

After completing this tutorial, you should be able to:

  • Add the Adobe PatchPanel SWC library, cs4.swc, to your Flex Builder Project
  • Import the host CS applications ExtendScript DOM
  • Copy your ExtendScript code from ExtendScript Toolkit to Flex Builder
  • Know what the appropriate color object structure is within the DOM of the three possible host applications
  • Install the SWF and accompanying JSX/JS file so that it is accessible from within Photoshop and Illustrator

Continue reading at Adobe Developer Connection . . .

“Size By Luminance” a.k.a. Halftones!!! (Wundes)

Tuesday, June 2nd, 2009

[Editor's note: This new script from John achieves that old fashioned halftone look found in ancient newspapers and magazines.]

Republished from John Wundes’ JS4AI blog.

Want to make halftones in illustrator?

You could go the auto trace route, or you could go with a plug-in from Phantasm. The Phantasm plug-in is powerful and gives you great control, so I do recommend using their product, but if you’re on a tight budget, you can try my new script which is easy, and free.

First off, if you don’t know about the “Mosaic Filter” in Illustrator, read this quick article. The Mosaic Filter is an amazingly under-used feature and it will do most of the heavy lifting for us today. Filter>Create>Object Mosaic

Continue reading at the JS4AI blog . . .

Interview with MarineMAP Mashup Developers (Kelso)

Tuesday, April 21st, 2009

marinemapsupporttool

[Editor's note: MarineMAP is a cutting edge mashup built using PostGIS, GeoDjango, Ajax, Flash, OpenLayers, GeoServer and MapServer with Google base map tiles. It assists stakeholders in the design of MPAs (Marine Protected Areas) in mapping oceanographic, biological geological, chemical and human dimensions of the ocean and coastal areas. I talk with Will McClintock and Chad Burt of the Marine Science Institute at University of California at Santa Barbara about the technical underpinnings and development philosophy behind the project. One key to the project's success (rolled out Dec. 2008) has been the hiring of dedicated programmers to implement design ideas and new technology to extend an earlier version's usability and reach. Thanks Melissa and Sebastian!]

Interact with the MarineMAP at marinemap.org/marinemap.

Interactive Map Tool Objective: MarineMap is an internet-based decision support tool that provides the capacity for the SCRSG (South Coast Regional Stakeholder Group) to view data layers, create individual MPA concepts, assemble collections of individual MPA concepts into MPA arrays, receive basic feedback on how well MPA concepts and arrays meet guidelines for MPA design, and submit MPA arrays to staff as MPA proposals. This tool will be the primary way in which MLPA Initiative staff and SCRSG members capture and store information regarding MPA proposals.

marinemapsupporttool2

(Above) Screenshot above showing Marine mammal and Nearshore habitat layers on base map with area Measurement Tool enabled.

(Question) Kelso’s Corner: What technologies are leveraged in MarineMAP?

(Anwer) MarineMAP: We’re not using ArcGIS at all, save for cutting map tiles (using ArcGIS Desktop and Arc2Earth) and, as a non-critical component of the system, ArcSDE / SQL Server. We’re mainly using PostGIS, GeoDjango, Ajax, Flash, OpenLayers, GeoServer and MapServer and will soon switch to the Google Earth API.

We are using OpenLayers, rather than the Google Maps API for our “slippy map”. OpenLayers is pure javascript, as is most of the client application. We are using Flex, but only for the charting component. [Editor's note: OpenLayers is using the Google Maps tiles.]

(Q) Kelso’s Corner: How many programmers do you have on staff to deal with all the software components?

(A) MarineMAP: Currently, two of our developers work full-time on MarineMap, while our other two developers work half time. We also have several GIS analysts and a cartographer to deal with the data end of things. We are now looking for a full-time, in-house Assistant Web Developer to continue working on MarineMap. As we extend MarineMap to different geographies and planning processes, we anticipate that we’ll be looking for one or two more programmers as well.

(Q) Kelso’s Corner: What was the rational for doing this substantial map development in house? Did you evalutate other routes, consultants, off the shelf software before going this route, why was this option preferable? Did you have a good cheat sheet for how to develop / implement this technology? Did you have to hire new staff to do the programming or did you have existing expertise to draw on?

(Anwer) MarineMAP: We did not have a cheat sheet for how to develop / implement this technology. This was a brand new application using some new technologies, and some that we were familiar with. Of course, we had experience developing other applications and some of these technologies overlapped. But, there was a significant amount of learning happening for all of our developers.

The MLPAI is an on-going process that will terminate sometime around 2011. Until then, we need to have a highly functional and stable application that can be adapted to the changing needs of the process. It turned out to be much more cost-effective and time efficient to hire in-house developers to work on the application year-round. Before we built our team, we spent a significant amount of time considering a host of alternatives, including trying to maintain and tweak Doris, contracting out all of the work, etc.  Initially, we felt we did not have enough in-house expertise. Although we already had Chad Burt (UCSB), Jared Kibele (UCSB), Tim Welch (Ecotrust) and, now, Ken Vollmer (Ecotrust) as our in-house crew, we eventually contracted two developers from Farallon Geographics (Dennis Wuthrich and Alexei Peters) for a limited period to  help with developing the database schema. This was particularly nice given that we had only 6 months to get the first version of MarineMap out the door. Dennis and Alexei are no longer working on the project but I am very grateful that we had access to their time and expertise during the initial phases.

(Q) Kelso’s Corner: What was Doris?

(Anwer) MarineMAP: At the beginning of the Marine Life Protection Act Initiative (MLPAI), staff chose to hire consultants to build an application (eventually called “Doris”) that was built on ArcGIS Server 9.1 technologies. It shared some of the features of MarineMap, including drawing MPAs and arrays, and generating reports on what was being captured inside those MPAs. Doris had a poorly designed interface and, perhaps more significantly, it was dreadfully slow. Consequently, few stakeholders used it. Furthermore, because the application was built using technologies with which we had no particular in-house expertise, and because these technologies were proprietary, we had a difficulty updating the application or tweaking it on the fly. (I had been running ArcSDE / ArcIMS and ArcGIS Server applications for a couple years but had no real development expertise in, say, ArcObjects, or VB .Net.)

(Q) Kelso’s Corner: It seems there are many more RubyOnRails developers than Django. Have you found this a hindrance for hiring staff or when looking for trouble shooting advice?

(Anwer) MarineMAP: It does seem to be a bit of a challenge finding Django developers, particularly those that can / will work locally. I have not tried to hire a RubyOnRails expert so I have no direct means comparison.

(Q) Kelso’s Corner: Why will you be switching to the Google Earth API? Is this only for the front end? Have you been happy with GeoDjango?

(Anwer) MarineMAP: GeoDjango has been fantastic. Using the Google Earth API does not mean ditching GeoDjango. Rather, using the Google Earth API represents a shift away from the OpenLayers API. We’ll still be using GeoDjango extensively.

[Our lead developer] was a big proponent of RubyOnRails for quite some time, but Django has taken many of its best ideas to Python. While Ruby is aesthetically a beautiful language, Python is usually much faster and has a more mature set of modules to build on. The only thing I miss after switching over to Django is the database migrations Rails offers. Most open source GIS packages also have bindings for Python, where as there a few similar tools for Ruby.

Switching to the Google Earth API will just mean replacing OpenLayers. OpenLayers is a very good library, but the Earth API is much faster due to the fact that it is a compiled plugin rather than being written in javascript. This allows it to display thousands of placemarks on screen at once, which is one of the primary reasons for switching. Google Earth can also display temporal and 3d data.

(Q) Kelso’s Corner: Besides the change to Google Earth API, what other changes, updates do you plan for this online map?

(Anwer) MarineMAP: Besides switching to the Google Earth API, there is one major upcoming update to MarineMap. Specifically, we will be implementing a map-based (i.e., location based) discussion forum. Users will be able to zoom into a location on a map and tag objects (MPAs, data, places) with a comment. Other users will see these comments (if they have comments “turned on”) as they zoom in to a location or if they load an MPA. Users can then participate in a dialog via a traditional discussion forum that is linked to the map. Furthermore, users will be able to define a geographic region and subscribe to RSS feeds (using GeoRSS) for any activity within that region. One might choose to do this, for example, if they want to be notified by email any time somebody draws a new MPA in, or makes a comment about a data layer in a specific region that he / she cares most about. I believe the map-based discussion forum will go a long way in facilitating discussion about MPAs, particularly outside the in-person monthly stakeholder meetings.

Conclusion: Thanks so much for the informative Q&A session. Please check out the MarineMap project at MarineMap.org/marinemap.

Great Script for Simplifying Paths in Illustrator (Kelso)

Monday, March 30th, 2009

[Editor's note: Cartographers looking for Douglas-Peucker type line simplication in Illustrator now have a solution to Illustrator's default simplify command when trying to generalize features like river oxbows. Jim started on the problem of fixing an Illustrator bug (see image above) where redundant points were created in the path outline command, and now has a more generalized solution.]

Jim Heck shared an amazing tool for Adobe Illustrator with me recently to deal with the irritating bug in versions CS3 and CS4 where redundant points (stacked on top of each other, illustrated above where the dupplicate points are pulled away from the basic shape) are created on outline or offset of a path’s stroke. The script (in Javascript) and Action set he created quickly remove these redundant points while still keeping the path shape. He does this with a bit of behind the scenes trigonometry wizardry. Please note this bug still exists in CS4 contray to rumors, though is lesser virulent form than CS3 (confirmed by me via email with Adobe engineers).

I’ve worked with Jim to refine it the last couple weeks. I think it’s ready for prime time now.

Screenshots:

Settings shown to remove redundant points for outlined path screenshot above. I used a tolerance of 12 points for the river ox bow screenshot below.

How it works:

  • Selected path points only or all document paths
  • Set distance tolerance in page units (optional)
  • Works in locked objects
  • Works in compound paths
  • Reporting, Selection, and Removal modes

Cartographic applications:

I illustrate below the result of using Jim’s generalization script on a typial river path and you can see in area 1a and 2b how the ox bow removal is light years above Illustrator’s default path simplify command which grossly distorts the shape in the pursuit of point removal. Jim’s script preserves the shape and removes the tiny, tight wiggles. It needs a little bit more programming work to fix areas 1b and 2a + 2c where the shape is loosing some fidelity for not keeping the trailing point in the series of removed points. And maybe needing to keep an intermediary point between 2a and 2c for shape since this is a longer removal?

With a little more tweaking, this tool will become popular for cartographers since we often want to simplify lines while keeping the overall geometry shape when reducing clustered points. The opposite may be achievable, too, when adding points selectively to long curves, but NOT to segments of the line that are already dense with points. But that’s for a 2.0 release ;)

Download the script and actions from Jim Heck’s site . . .

ActionScript Bezier Curves (Cartogrammar)

Friday, March 20th, 2009

[Editor's note: For those programmers in AS3 wanting to draw pretty curves ala Postscript, PDF, or Illustrator.]

Republished from Cartogrammer. View comments there for updates.
January 5, 2009. Andy Woodruff.

[Andy] finally opened [his] CubicBezier AS3 class, the only reason anyone ever finds this site at all, for the first time in many months to attempt to address some of the various comments and reported problems from the original. It’s not perfected, but [he's] done three things:

  1. Added a “moveTo” argument to the curveThroughPoints method, following the idea in one comment on my blog post. Ignore it if you wish, but if you set it to false, the curves will connect to wherever graphics drawing left off rather than moving to the beginning of the curve and starting anew.
  2. Hooray trigonometry! Messed with some of the angle calculations to fix problems with zero angles and division by zero. I hope it worked.
  3. Provided a line of code that can be altered to use lineTo for straight segments of 3 or more points rather than curving.

Straight lines were raised as an issue in several comments. While I think I have fixed the crazy behavior of straight horizontal and vertical lines, I suspect the result for three points in a line may be surprising at first glance. For instance, the three middle points in the image below are all aligned horizontally.

Straight line with S-curve

The S-curve through those points may look odd at first, but it’s actually to be expected with these cubic Bézier curves. Of those three points, only the middle one has curve control points that are also aligned horizontally. The outer two have control points that are also based on the points outside the line. Here’s an approximate example from Illustrator of what they look like

S-curve in Illustrator

I’ve left that as the default behavior, but I did insert some code that can be modified so that the curve essentially stops curving when it reaches several points in a line, draws a straight line through them, and then continues curving as normal after that. Here’s what the same example looks like with that option enabled.

Straight line with lineTo

It’s probably often fine, but I caution that it can result in sharp corners. Here’s the same with those dots removed:

Straight line with lineTo and sharp corners

I’m uncertain what’s best, so I’ve made that a line of code that has to be changed rather than a more accessible option. I’d be glad to hear ideas on how best to handle it. Feel free to change it however you like, of course. That and other modifications are identified in the comments.

Download the class here: CubicBezier.as
The previous version is here, in case I screwed something up. Forgive my lack of version control.

Script: Place Multiple Files in Illustrator (Kelso)

Tuesday, March 10th, 2009

[Editor's note: This new script allows multiple files to be placed into Adobe Illustrator at once. Illustrator's native place command can only handle 1 single file at once. This script was commissioned by Eric at Nutshell Communications, Inc.]

This script will allow you to (import) place multiple files as separate named layers from a designated folder to a new Illustrator document. The files are all placed at once, you don’t get to control individual placement (but of course you can modify location after the script runs). Script should work with CS2, CS3, and CS4, both Mac and Windows.

To install new scripts you need to:

  • Download either the IMAGES version (eg, JPG, GIF, TIF, etc) or the EPS version.
  • Quit Illustrator
  • Copy the script file into the Illustrator application folder’s “Presets” » “Scripts” subfolder. If you are in CS4 this will be the application folder’s “Presets” » “en_US” » “Scripts” subfolder (transpose “en_US” with your local language string).
  • After restarting Illustrator, you can find the scripts in the menu “File” » “Scripts”;
  • TIP: You can create subfolders in the scripts folder to organize your scripts

Usage

  • The script asks for a folder to be selected by the user in a normal file open dialog.
  • All loose files are examined and if they match EPS file type then they are placed (nested folders not examined).
  • It is easy to limit this to EPS or add other file types (see below)
  • The files are placed into the middle of the document (or registered to a 9-point page location).
  • Each placed file gets its own layer, the layer name matches the placed file’s name.
  • The file is not auto-saved. You do that manually.

Placement Options

Line 7 controls the placement of the imagesinto the document. These are 9-point registration of ul, ml, ll, um, mm, lm, ur, mr, lr.
var placement9pointAlignment = “mm”;

Adding More File Types

Line 33 controls which file extensions are supported:
if( (fName.indexOf(“.eps”) == -1) ) {

You can easily expand the file types supported as shown in the commented out line in 34:
//if( (fName.indexOf(“.eps”) == -1) && (fName.indexOf(“.gif”) == -1) && (fName.indexOf(“.jpg”) == -1) && (fName.indexOf(“.png”) == -1) && (fName.indexOf(“.bmp”) == -1) && (fName.indexOf(“.tif”) == -1) && (fName.indexOf(“.psd”) == -1)) {

To allow more file types, use the formatting and grammar as in line 34.

A Magic Wand for Selecting Text in Adobe Illustrator (KELSO)

Friday, March 6th, 2009

[Editor's note: This is largely a republish of my post here last September and before but with the added benefit of now being a public alpha (download version 11d) of the script that is good thru summer 2009. Why am I expanding testing? I'd like more feedback as I haven't heard of any major problems with the script. And I need a little motivation to finish programming ;) ]

I have been developing a plugin / script for Adobe Illustrator to make it easier to select type in Illustrator by  attributes like font family, style, size, and fill color. I hope to release this as a commercial plugin for designers and cartographers first quarter 2009? If you would like to beta test this plugin for me, please send me an email at nathaniel@kelsocartography.com or…

Download version 11d of Find and Replace Fonts Script (1.6m). Good thru summer 2009.

¡¡Warning!! This is not final release-quality product!!! Please save your work before running the script. I have never had it crash my machine but don’t take chances!!! Use at your own risk!!!

To install new scripts you need to:

  • Download the ZIP file using “Save as”.
  • Quit Illustrator
  • Copy the script files into the Illustrator application folder’s “Presets” » “Scripts” subfolder
  • After restarting Illustrator, you can find the scripts in the menu “File” » “Scripts”;
  • TIP: You can create subfolders in the scripts folder to organize your scripts

NOTE: You will need version CS3 or CS4 of Illustrator. If you have CS or CS2, get a trial version of CS4 from Adobe.

Insure you get further updates to the Script by joining this email list:
Name:
E-mail:

What is this tool and why would you use it?

  1. A magic wand for clicking on text and selecting like-styled text
  2. A non-modal eye dropper tool for copying font attributes and pasting them onto other text objects without directly eye dropping (like Freehand’s copy and past attributes).
  3. Menu items for Select > Type > Same font, same style, same size, same font color, overprinting, etc
  4. A pro version of the Find Fonts dialog already in Illustrator that does find / replacing in locked and hidden layers, or only in the active layer, sublayer, or window view.

Usage Tips

The resulting non-contiguous text can only be affected (eg: by the Character panel) by:

  1. Hitting escape on the keyboard and then making changes
    • but the original instance will not be changed
    • all others will be, though
  2. The entire text object was selected
  3. Initiating the “similar text (described in 2nd New features below) in text object mode, NOT text range or text insertion point mode.
  4. Using the Full Dialog mode’s replace functions
Looking Forward

Developing the plugin has taken a lot longer than I expected to implement all the basic and advanced features but I am now 90% complete with the script version, which is over 8,000 lines of code or a 300 page book! I need to start working on the plugin version which will entail completely translating the script from JavaScript into C in XCode on the Mac and Visual Studio on the PC.

  • Port to XCode and start testing as Illustrator Plugin, first for Mac, second for Windows

  • Settle on price and start selling. Perhaps thru a distributor.

  • There will be a cheap version and a pro version.

Turning the script into a plugin will bring several benefits:

  • Speed: much faster execution
  • Work with 1,000s of type objects / characters, not 100s
  • Menu items that can be assigned keyboard shortcuts
  • Can be recorded with Actions for automating routine tasks
  • New tool: magic wand for text and non-modal eyedropper for text font appearances
  • Allow me to recoup development costs

Example uses:

  • Selection:
    • Find all other type objects with same font – View video
    • Find all other type objects with same type size – View video
    • Find all other type objects with same character fill color
  • Applying / creating character styles:
    • Cartographer: ArcMap text imported to Illustrator >> have plugin apply matching style or create new styles that match each of the implicate styles
    • Designer: Quickly comp out a design and select all matching text with certain font attributes with the new Text magic wand tool and make them styles. Great for deadline projects.
  • Find and Replace fonts on hidden and locked layers (better than Illustrator’s default Find Font)

Demonstration videos:

Selecting by Font Color – Basic

Including exactly the same color, pattern, swatch, same color mode, by character and by object.

View video – 7.8 megs

Selecting by Font Color – Advanced

Including selecting type object NOT a color and overprints, replacing with knockout.

View video – 17.2 megs

Changing Alignment and Registration of Type

Includes limiting to just point, area, or line type objects

View video – 11.0 megs

Why Change the Registration for Point Type?

To scale type size when it is registered to a townspot or other graphic element.

View video – 1.1 meg

Finding Scope

Limit your selection to active layer, sublayer, current view, selection, artboard/page, and document.

View video – 20 megs

Finding by Text Content

Find all type that has the “River” or “Road” or “Street” in it and then change those text range’s attributes. Options include Is, Starts, Ends, and more.

View video – 13.5 megs

Replacing by Text Contents

With exact phrase or add to the end or beginning of the matched text.

View video – 9.3 megs

Simplified Interface

This dialog is similar to what’d you see for the planned “magic wand” for type tool settings. Thanks to Tom for this suggestion!

View video – 7.6 megs

FEATURES NEW THIS VERSION (and the Last)

  1. Significant speed increase
    • Will now deal with 100s of text objects (or characters in a single text object)

    • But still slow in 1000s of text objects; change seach scope to text frame for best result
  2. Now selects ranges of text, not just text objects!
  3. “Just do it” non-dialog scripts
    • Select text with same font face and style
    • Select text with same font size
    • Select text with same font face, style, and size
    • Select like text within current selection
  4. Zoom to next and previous matching objects

  5. Can initiate “similar” text font styling based on currently selected

    • Text object

    • Selected text range within text object

    • Text insertion point within text object
  6. Non-contiguous text that matches search criteria will be selected in the same text object
  7. Character styles can now be found and replaced
  8. Find options revamped
  9. Selection (results) scope now functional
  10. Hidden and locked layers now (mostly?) functional
  11. Less use of pure math logic in GU

  12. Fill color now works.

  13. Registration and Justification now work

  14. Simple dialog interface

  15. Search in active layer, active sublayer, and current document view

STILL NOT FIXED
  • Character styles has a few bugs relating to color

  • Find by text string still hinky

CONCLUSION

Please let me know what you think, what bugs you find, and how it can be made more useful. Send to nathaniel@kelsocartography.com.

If you couldn’t find the download links above, here it is again:

http://kelsocartography.com/beta/frf/files/FindReplaceFonts_a11d.zip

Noncontiguous Area Cartograms (IndieMaps)

Monday, March 2nd, 2009

[Editor's note: Zach Johnson promotes his Actionscript 3 class for producing non-continuous cartograms and gives background on why these are better (and easier to construct) than Gaster-Newman continuous cartograms.]

Excerpted from IndieMaps blog by Zach Johnson.
View full blog post from Dec. 4, 2008.

Fully contiguous cartograms have stretched and distorted borders but perfectly maintained topologies. Like the Gastner-Newman diffusion-based cartograms we see all over the place. Though all sorts of cartogram designs have been produced, those with perfect topology preservation (fully contiguous cartograms) receive the majority of academic and popular press attention.

< snip >

Judy Olson (Wisconsin Geography alum natch) wrote the only academic article to focus specifically on this cartogram symbology in 1976. She believed noncontiguous cartograms held three potential advantages over contiguous cartograms (I’ve three more below):

  1. “the empty areas, or gaps, between observation units are meaningful representations of discrepancies of values, these discrepancies generally being a major reason for constructing a cartogram”
  2. production of noncontiguous cartograms involves “only the discrete units for which information is available and only the lines which can be accurately relocated on the original map appear on the noncontiguous cartogram”
  3. because of perfect shape preservation, “recognition of the units represented is relatively uncomplicated for the reader”

Despite these inherent advantages (along with ease of production), all the early value-by-area cartograms I’ve seen maintain contiguity. Some took the radical step of abstracting features to geometric primitives, like Levasseur’s early French examples (which may not have been cartograms) and Erwin Raisz’s early American “rectangular statistical cartograms”. But in many ways the noncontiguous design is the more radical cartogram, as it actually breaks the basemap apart — rather than skewing shared borders it abandons them.

my [his] AS3 classes

Olson outlines a technique — the projector method — for manually producing such cartograms. A projector capable of precise numeric reduction/enlargement was required, but not much else, and accurate cartograms could be produced in minutes. A scaling factor was calculated for each enumeration unit, the projector was set to this value, and the projected borders were traced, keeping units centered on their original centers.

My [his] AS3 NoncontiguousCartogram class works similarly. It takes an array of objects containing geometry and attribute properties and creates a noncontiguous cartogram. I include methods for creating the input array from a shapefile/dbf combo, but using KML, WKT, or geoJSON representations wouldn’t be too hard. Methods are included for projecting this lat/long linework (to Lambert’s Conformal Conic projection at least). The NoncontiguousCartogram class draws the input geography, figures the area of each feature, and scales figures according to their density in the chosen thematic variable.

It’s all good/in ActionScript 3, so can be used in Flash or Flex. The zip distribution includes the following:

  • the main NoncontiguousCartogram.as class
  • two example applications and the data needed to run them
  • utility classes, including some that make creating cartograms from shp/dbf input quite easy
  • Edwin Van Rijkom’s SHP and DBF libraries, which are used to load the shapefiles in both of the included examples
  • Keith Peters’ MinimalComps AS3 component library, for the components used in one of the examples
  • Grant Skinner’s gTween class, which is required by the NoncontiguousCartogram class for tween transitions

Browse all the above or download the zip.

<snip>

more advantages

In my thesis research last spring, noncontiguous cartograms performed quite well: subjects rated them highly on aesthetics and could locate and estimate the areas of features with relatively high accuracy. I would add the following to Olson’s list of noncontiguous cartogram advantages.

  1. Olson concentrates on the perfect shape preservation of noncontiguous cartograms. The form (well, those with units centered on the original enumeration unit centroids, as in Olson’s projector method) also perfectly preserves the location of the features on the resultant transformed cartogram. Not only are features easier to recognize, but locations within the transformed units can be accurately located as well (cities or mountain ranges from the original geography can be accurately plotted on the transformed cartogram).
  2. Because units are separate on the transformed cartogram, their figure-ground is increased and areas of features can therefore be more accurately estimated.
  3. Many cartogram designs (including most manual cartograms and the Gastner-Newman-produced cartograms) sacrifice some accuracy for shape recognition. This is a defensible tradeoff, especially as area estimation is notoriously inaccurate and nonlinear. Yet it’s a tradeoff that noncontigous cartograms need not make, as they can always perfectly represent the data with relative areas without sacrificing shape preservation.

Thus, noncontiguous cartograms seem to excel at the cartogram’s two main map-reading tasks: shape recognition and area estimation. This is mediated somewhat by the chief advantage of contiguous cartograms: compactness. Because no space is created between enumeration units, contiguous cartogram enumeration units can be larger than those on noncontiguous cartograms, all other things equal. The increased size on contiguous cartograms may improves their legibility.

Read the full entry over at Indie Maps . . .