This article introduces you to Chameleon, a tool that makes it a lot easier for the non-programmer to build Web mapping applications using MapServer.Chameleon is just one tool you could use.I’ll introduce some others at the end of the article.By Open Source GIS Columnist Tyler Mitchell.
First some definitions, and basics about how Chameleon fits into the application development process.MapServer is a Web mapping development platform originally developed by the University of Minnesota.It is often referred to as the "UMN MapServer project." An international team develops this software using an open source approach, making it free to use, customise and distribute.MapServer comes as a CGI executable application that can be used with a Web server.
MapServer also comes with an API called MapScript, giving programmers the option of writing custom mapping functionality that the CGI version does not support.MapScript makes it possible to incorporate mapping functionality into custom programs using several different languages.But, many developers of Web mapping applications are not programmers, and are unable to tap into the power of MapScript.To build sophisticated MapServer Web mapping applications, you need several sets of skills, including:
- Web server management
- Mapping server management (e.g.MapServer map file creation)
- Graphical interface design/layout (HTML)
- Acquiring and preparing data.
Chameleon is an excellent framework for building web mapping sites.It can use MapServer behind the scenes or pull data together using the Open Geospatial Consortium (OGC) specifications for web map servers (WMS).Figure 1 shows a typical configuration.
DM Solutions Group (Ottawa, Canada) developed a set of re-usable components for clients in the Government of Canada.The result is the large set of components that make up the Chameleon framework.They needed a way to integrate web map servers and make them accessible through easy-to-use web interfaces.Now, MapServer-like functionality can be added to any Web application.
Using Chameleon Functionality
Chameleon is a set of over 300 PHP scripts that provide access to mapping-related "widgets" and functions.You don't need to know how these scripts work to use them.They are built using PHP MapScript behind-the-scenes, but allow you to simply deal with HTML tags.For example, by using Chameleon HTML tags, a designer can add a map, scalebar, legend, query tools, printing tools and much more to an application.
developers use Chameleon by adding the
tags to HTML
template pages.They are called CWC2 tags, short for "Configurable Web
Mapping Client Components." Using these tags provides a simplified
method for adding mapping content to a web application.Figure 2 shows
an example of some of the behind the scenes code contained in a widget.
|Main map image:|
|Legend with layer visibility controls:|
Each tag includes parameters for customising the function of the widget.There are over 100 widgets available, mostly aimed at providing options and tools to the user.Some other widgets are:
- ExpressionBuilder - for building data filters
- CatalogSearch - for searching OGC catalog services
- MapSize - for changing the size of the map on-the-fly
- ProjectionSelector - for changing the map projection
- PrintProduction - for producing print-friendly graphic files
Requirements for Installation
Chameleon can be easily installed on most platforms, especially if a binary MapServer installer/package is used.
Both of these install packages include a Web server and a fully functioning PHP environment with PHP MapScript ready to use.If you do not plan to use their built-in Web server, then you will need to configure your own aliases.
If you already have a MapServer installation running, with PHP MapScript ready to use, then the installation process is not too difficult.Simply download and extract one of the Chameleon code packages and configure some XML-based configuration files.Working From Sample Applications
Chameleon comes with a handful of sample applications that are great for getting started.These examples show you how a typical Chameleon application is put together.There is usually a PHP file as the starting page, indicating several settings:
- Where the Chameleon system files are located
- What MapServer map file (or OGC map context Document) to use for drawing features and accessing data sources
- What template HTML file to use for laying out the page
Web designers can focus on the Web layout and application look and feel.Geospatial application developers can manage the map presentation and interaction components.Data custodians can focus on pre-processing data and making it available to the application.Standard Look and Feel
Chameleon comes with a default "skin".This provides clear and attractive tool buttons which are laid out using cascaded style sheets (CSS).Web designers can create their own button images and page formatting, but for those who are not Web designers, a set of attractive tools is ready to use out-of-the-box.Figures 3 and 4 show screenshots of two Chameleon-based Websites.
Interactive Tools Ready to Go
- Re-usable components.As you develop or customise your own widgets and templates, they can be re-used in other Chameleon applications.
- Advanced features.The enhanced sample application is quite impressive.It includes Postal Code look-ups, interactive annotating and labelling, changing map size, printing, querying and more.
- Shortened development cycle.Understanding how to set up and use Chameleon allows you quickly create new sites, based on settings used in other ones.In many cases, the only changes needed are within a MapServer configuration file.
Chameleon has an active and growing support network.An interactive help viewer shows widget documentation, including syntax examples. Mailing list support is excellent, with direct assistance coming not only from DM Solutions but from other developers and users worldwide. Users and developers openly share custom widgets and templates to help new users.Commercial support is available from many of the companies who develop using Chameleon, as well as from DM Solutions.
Not being an avid programmer, I had shied away from using any MapScript-based applications in the past.When Chameleon first came out, I wasn't sure how useful it would be for my needs.Now it is the MapServer framework I use most.Chameleon has encouraged me to dust off my programming skills, taking existing widgets or templates and making small changes, rather than starting from scratch.With a minimal amount of work I can quickly create a map file and make a professional looking, sophisticated web mapping site literally in minutes.
Here we've focused on Chameleon.But there are other options, which are at varying stages of development.A few examples include:
- MapBender - http://mapbender.org
- CartoWeb - http://cartoweb.org/
- ka-Map - http://ka-map.maptools.org/
- Flexible Internet Spatial Template (FIST) - http://datashare.gis.unbc.ca/fist/index.php