Flash/SWF for GIS
By Chris Goad , The Map Bureau
The advent of programmable vector graphics in web browsers has major implications for GIS on the web.Vector-based web maps can include many forms of interactivity that are handled at the web browser with minimal need for refreshes from the server.
These range from simple zooming and panning, through interactive selection of the data to displayed, up to animated display of temporal processes.Indeed, the online map of the future will present a much richer weave of data and interaction than is currently found even in the user interfaces of GIS systems, let alone in the typical online map experience of the present day - an experience which is typically characterized by a frustrating back-and-forth between viewing of a static map and waiting for the server to download an update.
The event calendar which appears weekly in the DirectionsMag newsletter illustrates the use of this technology for a simple but novel application:
More examples are referenced at the bottom of the article.
Vector capability has been available in principle in the form of Java applets for many years, but for whatever reason, has not been widely used in online GIS applications.The more recent vector graphics technologies for web browsing are Macromedia Flash and SVG.Whether knowgingly or not, nearly every user of the web has been exposed to Flash in the form of the animated illustrations and banner ads.SVG (Scalable Vector Graphics) is a standard recently developed by the World Wide Web consortium (W3C).A recent article in this publication described GIS applications of SVG in some detail.The current article concentrates on Flash, and its advantages and disadvantages as a vector technology for GIS.More precisely, the comparison is between SWF - the file format used in Flash, and SVG, and between the available technologies for rendering and authoring the two formats.
SWF and SVG are in many respects similar technologies, and both satisfy the basic technical requirements needed to support a rich GIS experience on the web.These requirements are: (1) vector (rather than raster) representation of 2D geometrical objects (2) availability of event handling primitives that allow flexible design of interactivity (3) full access from a programming or scripting environment to the geometric and event models, so that arbitrary kinds of animation and interaction can be programmed, and (4) the ability to query the server as needed for incremental updates to the map.SWF and SVG are similar not only in the fact that they both meet these requirements, but in how they represent geometrical data: their primitives for modeling and manipulating the geometrical world correspond closely, though not exactly.
In areas other than geometrical representation, there are significant differences between SWF and SVG.In SVG's favor is its status as an XML language developed under the auspices of the W3C. SVG draws heavily on a variety of XML-related technologies, such as DOM, XLINK, and SMIL, for much of its functionality.A number of practical advantages flow from this, including excellent integration with other web technology, applicability of standard XML tools, familiarity to the large XML community, assurance of long-term stability, and the probability if not certainty of wide-spread adoption.On the downside, the aggregation of all of the standards and technology involved in full SVG functionality is dauntingly complex.
SWF was designed by Macromedia as a lightweight technology with priority given to the requirements for wide-spread adoption.Chief among these was a small plugin for swift downloading, and extensive support for authors and developers to speed the creation of compelling content.The Macromedia SWF authoring tools are particularly effective in three areas: support for creating animation and interaction without programming, integration of sound and video, and integration with server-side applications and development tools, both those of Macromedia and others.
Macromedia has been successful in its efforts: the Flash plugin for Internet Explorer on Windows is 383KB versus 2.3MB for the Windows version of the widely used SVG plugin from Adobe.There are more than one million Flash developers.The Flash player is present in more than 400 million web browsers, recently estimated at more than 96% of the online population.SVG, on the other hand, is a new standard which has not yet achieved ubiquity.
Although SWF is proprietary in the sense that its design is under the control of one company, specification of the format itself is publically available on the web, and tools for generating SWF are available from several sources.A free C++ SDK for writing SWF files is available for download from Macromedia.No royalties are involved in generating or distributing SWF content.The Flash player supports calls to and from scripts running in the browser, making integration with other kinds of web content easy to accomplish.
Where does all of this leave the GIS community? The standards-based approach of SVG makes it highly attractive as a sharable representation of interactive maps for use within the industry, and SVG is already being rapidly adopted for this role.However, there is another purpose for interactive maps: communicating geographical information to the web-browsing public at large.Several applications of this kind are well established, such as route finding services and weather maps. These established applications can be improved in performance and usability with vector-based technology, and there are exiting new possibilities as well.
It is in this role that SWF is an attractive alternative.SWF has the compelling advantage of needing no download of a plugin for most viewers.Requiring a 2.3MB download of an SVG player to view a map is not a realistic way to reach the web masses. If and when the standard installations of popular browsers include support for SVG, and these new browsers have propagated out to the public, this advantage will be reduced.However, the Flash authoring tools and Flash development community will continue to weigh in the balance, and Flash is likely to continue its rapid evolution.
In conclusion, the advent of programmable vector graphics in web browsers will lead to a revolution in the way geographic information is presented online over the next few years.More people on the web can be reached right now with Flash/SWF than with SVG.SVG, on the other hand, fits fully into the W3C world of standards, which will be a decisive advantage for many applications.In any case, we are lucky to have two technologies to support the revolution.
Examples of SWF in mapping applications
Temporal maps from Map Bureau
Map of a cross-country trip with photographs every mile, developed by Second Story Interactive for Kodak
Maps of ski resorts
Map gallery from FreshMaps, including interactive trade show and real estate maps
Layered interactive map of the Middle East
Educational map building tool from Maps.com
Animation of the build-out of the University of Oregon campus from the U of O InfoGraphics Laboratory
About Flash/SWF technology
The Flash home site
The SWF file format
A detailed technical comparison between SWF and SVG.