XML.com: XML From the Inside Out
oreilly.comSafari Bookshelf.Conferences.

advertisement

Build AJAX-Based Web Maps Using ka-Map
by Tyler Mitchell | Pages: 1, 2, 3, 4, 5, 6

Customize Look and Feel

ka-Map doesn't automatically pick an appropriate scale for your web browser's window size or screen resolution. It always uses the first one you have specified in config.php. Therefore, it is difficult to know exactly what your map will look like on another screen. This is more of a problem when the geographic extents of your application cover all your data. When there is more data outside your map area it helps fill the screen better.

Customising the index.html code allows you to change the way the interface looks. For example, you can change the colours, add logos, etc.

Cleaning Up the Cache

Sometimes you really need to clean out the cached tile data and start over, especially if you are modifying your map file or map scales. It would be good to have a more automated way of clearing the cache, e.g. a button on the web page. Until then, you need to delete all the files in your cache folder. For example, clear out all files and folders from /opt/fgs/apps/kamap-0.1.1/htdocs/tmp/.

Note that if you turn on the debug option, you will need to clear the cache when you turn it back off.

Prebuilding Map Tiles

Version 0.1.1 comes with a script called precache.php. This is a powerful tool that can really improve the initial performance of your application. You need to edit several pieces of the script before you can use it. Supply the map name (changing it from the default gmap) and set the scales that your map will be using. There is also a setting that calls the tile.php script. Make sure this points to tile.php on your server.

If you comfortable with PHP, you could modify the precache tool to pick up the settings from config.php. Then it could process all your maps for all the scales that your application is set up for.

Legend Handling

There have been some bugs in the way that legends are generated. If you do not include a LEGEND object in the global.map file, then the legend doesn't draw properly. Even if the LEGEND object is empty, it will allow ka-Map to render it properly. Having such a simple LEGEND object isn't a very good practice for normal MapServer applications, but works fine with ka-Map. By setting the TRANSPARENT option, it makes the legend look good on top of the web page background.

Advanced Functionality

More recent versions of ka-Map (i.e. CVS or version 0.2) have many more options and features. For example, an advanced, tree-like legend manager tool. This allows layers to be controlled as a group. This requires some more planning and appears to be somewhat unstable at present, but is certainly promising.

There are options for setting transparency for layers. You can then make one layer semitransparent and see it overlaid on top of another. Combine this with layer-visibility control and you can make some really interesting tools.

Some really powerful maps can be created using WMS data sources in your map file. This could, for instance, allow you to have one layer of changing data that is regularly updated, but never requires you to regenerate map tiles for all layers. This takes some thinking and caution, as you could easily flood a WMS provider, giving poor results, or mistreating a benevolent provider. Adding real-time WMS layers to your application is customisation that ka-Map does not come with out-of-the-box. If you want your WMS layers to be updated, then you will have to clear the cache and let it rebuild the cached tiles.

Conclusion

It took some time to get my first set up of ka-Map to work properly. I had switched between packaged source files and CVS, but found that the best way to get started was by using MS4W or FGS. The set up is relatively simple, but leaves little room for mistakes. Having an AJAX-based web-mapping platform is in high demand and ka-Map does a worthy job filling that need. Because it is an open source product, there is room for others to help develop it further. Whether you are a user or a developer, you can play a part in making the product better and more stable. I hope you enjoy using it as much as I have.

Links and Resources

In a previous article and some weblogs, I introduced some web-mapping tools. This is also the focus of my book, Web Mapping Illustrated. I have focused on the open source tools that are freely available, very powerful, in active use, and under continual development.

Here are links to some of the products and web sites mentioned in this article.

MapTools - http://maptools.org/
MapServer - http://ms.gis.umn.edu/
ka-Map - http://ka-map.maptools.org/
FreeGIS - http://www.freegis.org/
FWTools - http://fwtools.maptools.org/
Web Mapping Illustrated - http://oreilly.com/catalog/webmapping
Mapping Hacks - http://oreilly.com/catalog/mappinghks
My other articles and weblogs - http://www.oreillynet.com/pub/au/1898

In June 2005, O'Reilly Media, Inc., released Web Mapping Illustrated.



1 to 3 of 3
  1. Refreh Overlay
    2009-12-11 06:05:06 Mbabilonia
  2. Error when Ka-map is installed
    2008-01-24 03:07:26 AyoM
  3. Error popup: Argument for foreach & given map extent are invalid
    2006-01-18 09:50:57 H.
1 to 3 of 3