Richness or Reach?

By Peter McAtominey Strømberg

It's generally not a problem to publish geographic information to the Internet.Every GIS platform worth its salt offers its own solution.For the most part this involves generating images dynamically from data, for example MapInfo's MapExtreme, Intergraph's GeoMedia WebMap, Bentley's Web Publisher, as well as WMS (Web Map Service) servers.

The graphic formats used are GIF, JPG or PNG, as all these formats can be viewed in all major browsers on all platforms.This approach insures maximum "reach" -- that is to say your data will be viewable by the maximum number of users.However, as anyone who's ever tried working with desktop GIS programs will know, the bitmap approach sacrifices "richness." By this we mean all the neat functions that make GIS so useful, like the ability to read an object's attributes, to zoom and pan without a long delay while the server generates the next screen image.

Some manufactures have provided proprietary web client software to leverage what is possible in the standard web browser.Examples include Autodesk's MapGuide, as well as SVG.The major benefit when employing such a plug-in technology is that data is preserved as vector data, as opposed to being "rasterized" (generated as a bitmap).

Figure 1.A typical relationship between the richness of a web based GIS presentation and the number of people able to view the content.Click image for larger view.

Vector vs.Raster
I'm sure most GIS users are aware of at least some of the advantages of vector graphics when compared to bitmaps, or raster images, as they are also known.Raster images contain information about the colour of each pixel in a screen image, while vector images contain a mathematical description of an image.This makes it possible to zoom in and out of a vector image without losing image quality, as opposed to raster images that are produced to be viewed in a single scale.

Figure 2.Vector data
Raster data
Files in vector formats tend to be much smaller in download size compared to their raster equivalents.In addition, objects can maintain their attributes for use in interactivity.Try moving your mouse over the vector image above.The cursor shows a name text associated with each object.

Another advantage is of course the ability to "re-use" data at different scales.With a raster based system, for example a WMS server, every time the user zooms or pans a whole new image is created on the server, even though there may be no new data on the users screen (for example when one zooms in) or very little (for example if with a small pan).This makes great demands on the server, as well as an annoying wait for the user.With vector systems it is possible to just download the extra data to be shown, reusing most or all of the data already downloaded.The result is more speed, less strain on the server.This can translate to happier users plus cost savings in both hardware and bandwidth, not to mention the users' time.

So what's the drawback? In the case of MapGuide or Adobes SVG viewer, the drawback is an up to 3Mb download for the plug-in before you can begin viewing data.This might not be a barrier for avid GIS enthusiasts, but it is a big download for Mrs Jones who wants to check a bus route.

Richness AND Reach, the Promise of Flash
There is a format that offers vector functionality and is as widespread as JPG, GIF or PNG.Macromedia Flash.If you thought Flash was just for making annoying banner ads, think again.Over the past decade it has developed from being a rather nifty alternative to an animated gif to become a full-fledged multimedia programming platform.

It is particularly interesting for GIS developers because of its native support of vector graphics, it's interactivity and programming possibilities and not least because the vast majority of web browsers already have the player pre-installed, not to mention a growing number of devices such as PDAs and mobile phones.(Macromedia recently announced an alliance with Nokia amongst others).

Apart from vector graphics, today's Flash player can contain object structures, XML, bitmaps, audio and video.All these can be manipulated using Flash's built in programming language, ActionScript, an easy to learn scripting language very similar to JavaScript.ActionScript is based on the ECMA-262 specification.

Flash offers a richness way beyond any proprietary mapping plug-in, plus a reach unmatched by any other vector technology.The Flash player is pre-installed on 98% of users machines.This compares with 14% for SVG (no figure available for MapGuide).

Figure 3 Flash offers vector functionality in a widely distributable format, richness and reach. Click image for larger view.

Creating "SWF"
The file format used for Flash is called SWF (ShockWave Flash).The SWF file format, though developed and maintained by a single corporation, is an open file format.That means you can generate and use the file format without paying royalties.

Most SWF files and applications are created in the Macromedia Flash authoring tool, although the specification can be downloaded from Macromedia's website and used to create desktop and server programs that generate SWF files.

For PHP developers there is a very useful library available called MING, allowing server side generation of SWF's on-the-fly.

ActionScript has it's own drawing API enabling you to draw vectors and shapes programmatically from raw data or user input in the client itself.

Figure 4.Try clicking in the window below to draw a polygon.(After a point has been placed you can click and drag it around.) Click image for larger view.

According to Macromedia there are over a million Flash developers worldwide.There are at least three commercial systems available that generate SWF format from other GIS formats:
  • hyperGIS - converts GIS formats to Flash, interface to Oracle Spatial. Open Source Flash Client for custom development.
  • Demis - WMS server produces bitmaps as SWF files.Open Source Flash client available.
  • GeoClip - creates statistical maps in SWF format.

Published Wednesday, March 30th, 2005

Written by Peter McAtominey Strømberg