Friday, October 5, 2007


Map Widget - Pan/Zoom Widgets

This example shows how to add all of the widgets available as part of the Multimap API to the map. There are three types of widget available that can be added:

  • Pan/Zoom Widget;
  • Small Pan/Zoom Widget; and
  • Small Zoom Widget.

    These widgets control the panning and zooming of the map.

    The code demonstrates creating, adding and removing each of the available widgets on the map.

    The appearance of the widgets is set with a style sheet; the example shows these widgets in the Multimap style, but these can be changed to whatever appearance is desired by changing the style sheet. For more information on this, please see the Advanced Widgets example।


    MapServer dbox

    dbox is really a collection of DHTML-based libraries for building highly interactive web-based mapping applications. The tools are meant to work directly with the MapServer web mapping system. They provide relatively autonomous functionality without restricting overall design. In fact, they were designed to be used with old fashioned elements like tables.

    Functionality includes:

    • dbox.js (drawing canvas and image manager)
      • applied to pre-defined image or div anchor
      • "rubber-band" box tool
      • drag pan tool
      • linear drawing tool
      • polygon drawing tool
    • dLegend.js (legend manager)
      • tree-style navigation and layer control based on an XML legend file
    • dContainer.js (generic, scrollable container)
      • applied to pre-defined image or div anchor
    • mapserv.js (client-side coordinate management)
      • coordinates are managed completely on the client using javascript
      • MapServer is called as an image engine, no templates are used


    Thursday, October 4, 2007


    An open source suite of web-based tools that allow for the easy creation and management of MapServer web mapping applications and map files.


    MapServer Test Suite

    The MapServer "Test Suite" is a series of examples showing the many features of the most recent MapServer release. In most cases they are extremely simple examples, presenting enough information to show users how a certain function is used. The suite will continue to grow as MapServer matures. In most cases a link to templates and map files are provided. Since template files have a .html extension your browser will try to display the document. Use the view source capability of your browser to see how the template is structured.


    Simple Recipes for the UMN Mapserver

    When I started using the UMN Mapserver , I found myself often looking for a simple example that illustrated just one concept, and was small enough that I could understand just one piece of Mapserver without having to plow through lots of code. These Mapserver Recipes are my attempt to improve that situation.

    These examples are written using PHP/Mapscript. I assume you already have a working installation of Mapserver and PHP/Mapscript on your machine (although the first example can be used to find out whether you really do!).

    Take special note that you will have to edit SHAPEPATH ,IMAGEPATH , and IMAGEURL in each .MAP file to match your own installation. If your web server is not configured to use PHP/Mapscript for .PHTML files, you'll have to reconfigure your server or rename the recipe files.

    You can download all the the PHTML and MAP files at , and then follow the links to download the data files from USGS. At the moment this is the useful example:


     List Archives

    Archive of MapServer Users list. Check here before posting a question to the listserv, your question has likely been asked before...

    Public, Searchable Archive of MapServer-Users is available also.

    Wednesday, October 3, 2007

    MapServer Workbench

    What? A set of cooperative tools for development of MapServer web mapping applications.
    Where? See the SourceForge project page at 
    See it! Application Wizard   (msappwiz.tcl)
    Mapfile Editor   (msedit.tcl)
    Mapfile Explorer   (msexplorer.tcl)
    Shape Explorer   (msshapex.tcl)
    Get it! Download MapServer Workbench 0.3
    Download Mapscript/Tcl (includes pre-compiled Windows DLL!)
    Also, see the CVS and/or download files at the project page.

    When generating maps to be displayed on websites, which image output format should I use?

    Although Mapscript can generate the map in any desired image format it sufficient to only consider the three most prevalent ones: JPEG, PNG, and GIF.

    JPEG is an image format that uses a lossy compression algorithm to reduce an image's file size and is mostly used when loss of detail through compression is either not noticeable or negligible, as in most photos. Maps on the other hand mainly consist of fine lines and areas solidly filled in one colour, which is something JPEG is not known for displaying very well. In addition, maps, unless they include some aerial or satellite imagery, generally only use very few different colours. JPEG with its 24bit colour depth capable of displaying around 16.7 million colours is simple not suitable for this purpose. GIF and PNG however use an indexed colour palette which can be optimized for any number (up to 256) of colours which makes them the perfect solution for icons, logos, charts or maps. The following comparison (generated file sizes only; not file generation duration) will therefore only include these two file formats:

    GIF vs. PNG vs. PNG24 Generated Map File Sizes

      GIF PNG PNG24
    Vector Data only 59kb 26kb 69kb
    Vector Data & Satellite Image coloured 156kb 182kb 573kb
    Vector Data & Satellite Image monochrome 142kb 134kb 492kb

    (results based on an average 630x396 map with various colours, symbols, labels/annotations etc.)

    Although GIF shows a quantitative as well as qualitative advantage over PNG when generating maps that contain full coloured remote sensing imagery, PNG is the clear quantitative winner in terms of generated file sizes for maps with or without additional monochrome imagery and should therefore been the preferred image format. If the mapping application however can also display fullcolour aerial or satellite imagery, the output file format can be changed dynamically to either GIF or even PNG24 to achieve the highest possible image quality.

    How can I make my maps run faster (on Mapserver)?

    Some tips on improving performance.
    There are a lot of different approaches to improving the performance of your maps, aside from the obvious and expensive step of buying faster hardware. Here are links to some individual howtos for various optimizations. Some general tips for all cases:
    • First ands foremost is hardware. An extra GB of RAM will give your map performance increases beyond anything you're likely to achieve by tweaking your data. With the price of RAM these days, it's cheap and easy to speed up every map with one inexpensive upgrade.
    • Use the scientific method. Change one thing at a time, and see what effect it had. Try disabling all layers and enabling them one at a time until you discover which layer is being problematic.
    • You can use the shp2img program to time your results. This runs from the command line and draws an image of your entire map. Since it's run from the command line, it is immune to net lag and will give more consistent measurements that your web browser.

    Does MapServer support geocoding?


    Geocoding is an activity where you take a list of addresses and generate lat/lon points for them. This kind of spatial functionality is provided by proprietary packages such as the ESRI suite of tools, as well as services such as those provided by GDT. MapServer is for map rendering, and it does not provide for advanced spatial operations such as this.

    If you are using MapScript, there is a free geocder available through XMLRPC and SOAP at . You could hook you application up to use this service to provide lat/lon pairs for addresses, and then use MapServer to display those points.

    Features of mapserver


    • Advanced cartographic output
      • Scale dependent feature drawing and application execution
      • Feature labeling including label collision mediation
      • Fully customizable, template driven output
      • TrueType fonts
      • Map element automation (scalebar, reference map, and legend)
      • Thematic mapping using logical- or regular expression-based classes
    • Support for popular scripting and development environments
    • PHP, Python, Perl, Ruby, Java, and C#
    • Cross-platform support
      • Linux, Windows, Mac OS X, Solaris, and more
    • A multitude of raster and vector data formats
      • TIFF/GeoTIFF, EPPL7, and many others via GDAL
      • ESRI shapfiles, PostGIS, ESRI ArcSDE, Oracle Spatial, MySQL and many others via OGR
      • Open Geospatial Consortium (OGC) web specifications
        • WMS (client/server), non-transactional WFS (client/server), WMC, WCS, Filter Encoding, SLD, GML, SOS
    • Map projection support
      • On-the-fly map projection with 1000s of projections through the Proj.4 library

    Open GIS World !

    Few weeks back I was assigned an evaluation work of available Open Source GIS engines. My key interest was to check & compare the features of Web based Open GIS engines. I downloaded few of them, configured and checked different properties. After fighting hard in configuring new engines and checking the features, I started reading articles, blogs and other online data about other available open engines.

    I looked at :

    1. Featureserver
    2. FWTools
    3. GeoRss
    4. GeoServer
    5. GRASS
    6. MapGuide
    7. Mapserver
    8. uDig
    9. QGis
    10. etc
    After thorough assessment and evaluation, I was in LOVE !! And, all of my requirements are fulfilled by MAPSERVER.

    The analysis work proved the superiority of MapServer over others on following grounds:

    1. Intelligent Line Labeling (over curves).
    2. Partial Labeling.
    3. Intelligent Point Labeling (avoiding overlaps)
    4. Rendering Speed.
    5. Good documentation.
    6. Works with Multiple Platforms – Windows, Linux.
    7. Support for multiple data formats.
    8. Easy configuration.