The Project‎ > ‎Web Mapping‎ > ‎

Open Web Maps

There are two types of open web maps currently being served to the public through this Township GIS Project.  

The first is a basic open web map system involving a browser-based “thin client” like OpenLayers that requests and renders basemaps and overlay layers that are stored in various folders in the web server (Apache).  

The second is a web map created using data files served through an open source map server (GeoServer) software running on a different web server (Tomcat).

The work flows associated with each of these types of open web map are shown below.

The Basic Web Map

The procedure for a basic, minimal web map involves taking shapefiles from a township QGIS project and converting them to KML-format files.  QGIS has a built-in KML export function that could be used.  Alternatively, GDAL's ogr2ogr utility can also perform the conversion.  The two produce nearly identical KML files, the difference being mostly in the naming conventions (in the "<name>" tag) they follow for the attribute data schema and other items.  (QGIS calls on the ogr2ogr library for the actual file conversion.)     The styling information (color, opacity, line thickness, etc.) must be transferred from the QGIS project to the KML file manually.

Actually any data format supported by OpenLayers can be used at this stage, but this project uses KML because the same KML files can then combined and re-styled to produce a stand-alone KMZ file version of the web map.  Double-clicking on such a KMZ file (which is a zipped [compressed] version of a KML file) invokes Google Earth and plots the layer(s) onto a Google Earth screen (assuming Google Earth is installed on one's PC.)   These KMZ files can be made available for download from the participating township's website for viewing on a personal computer, off-line, using Google Earth --- thus providing yet another means of GIS data dissemination to the public.

Other reasons for using KML files include:
  • these files can also be used as data layers for Google, Bing, and other mashups should the need arise; and
  • KML files are ASCII (text) files that can be easily edited using a text editor (see Sustainability subsection)
  • most open source and proprietary desktop GIS packages as well as web mapping “thin clients” accept KML files as data
The project map server PC runs under a Linux operating system (Ubuntu 10.04 LTS) located at the server farm in the Cherry Capital Connection facility in Elk Rapids Township, MI.  It runs Apache HTTP Server as well as Apache Tomcat Server.  The basic web map configuration uses the Apache server, and serves the KML files (or other compatible data files) from folders in the map server PC accessible by Apache.  The HTML file containing JavaScript code that invokes the OpenLayers thin client also resides in these folders.

An example of a basic web map is the Elk Rapids Village Zoning Map.

A quick survey of the web servers of the participating townships reveals an even mix of Linux and Windows servers:

Participant Website Server (OS)
Acme Twp Apache (Linux)
Blair Twp Apache (Linux)
Clearwater Twp IIS (Windows)
Elk Rapids Vlg IIS (Windows)
Whitewater Twp IIS (Windows)
TART Trails Apache (Linux)

While the project uses an Apache Server installation in a Linux PC, a similar setup should work equally well on a Windows PC running the IIS web server.  Hence migrating the web maps from the project map server PC to the web servers of the participating townships should not be a problem, provided the townships' internet service providers (ISPs) agree to such a move.  

The GeoServer-based Web Map

The basic procedure for setting up this type of web map was introduced earlier in the Web Mapping through Michelle Ballinger's website.  In the words of the publishers, GeoServer:
... is an open source software server written in Java that allows users to share and edit geospatial data. Designed for interoperability, it publishes data from any major spatial data source using open standards.
For our project, this means is that web maps published through GeoServer are not limited to using data formats that are supported by OpenLayers and by Google and Bing Maps.  Because GeoServer can render map layers stored as shapefiles, among a huge variety of other file formats, the shapefiles created or modified by QGIS in the desktop GIS portion of our project can be rendered directly onto the web map by GeoServer; there is no need to convert them to KML or other formats.

However, the styling data for each shapefile must be stored in GeoServer as SLD (Styled Layer Descriptor) files.  This can be accomplished from within QGIS using a built-in SLD export function, or we can use uDig's SLD export function on each shapefile.  This project uses the uDig export function because the SLD files thus created seem to reproduce the original styling more faithfully than do SLD files created by QGIS, through more complete use of available SLD styling tags.  Hence a SLD  file created by QGIS may require more editing of the SLD code to achieve the original styling than one created by uDig.

GeoServer is a Java programming language-based servlet, an application which must run in a server (“servlet container”) instead of a browser.  One of the preferred servlet containers is the Apache Tomcat server.  The project map server machine has an instance of Apache Tomcat server installed, and within Tomcat is an instance of GeoServer version 2.0.2.

Map images, whether they are base maps or overlay layers, are served by GeoServer through Web Map Service (WMS) protocols.  GeoServer also can serve attribute data from map layers via Web Feature Service (WFS) protocols.   GeoServer supports a wide variety of raster and vector formats, all of which can be requested for rendering or for attribute data via WMS and WFS calls, respectively.

A useful GeoServer capability is the ability to automatically generate legend graphics based on the styling of the features in individual shapefiles.  Another advantage of using the Java-based GeoServer is the ability to use the Java “template engine” of FreeMarker, which is built into the GeoServer package.  FreeMarker simplifies the display of text and data on an HTML page.

The Acme Township Zoning Map takes advantage of the automatic legend graphics generation capability.  The data layers of this map, shown to the left, are served from GeoServer, whereas the basemap is a hybrid map layer served from Google Maps.  Some of the data layers are KML files, while others are shapefiles.  The legend graphics (next to the check boxes) are generated by GeoServer from styling information contained in the SLD files that correspond to shapefiles used as data layers.

There are numerous additional features of GeoServer that this project does not exploit at this stage.   The emphasis is in creating and disseminating GIS products for print and for the web as simply as possible, not in creating yet more complex map servers.   Doubtlessly as more complex desktop GIS products are produced by the Townships, the more advanced capabilities of GeoServer can be brought into play.  But it does introduce another layer of complexity in the web mapping activity, and is less sustainable by the townships than is the basic web map.

The project map server described above also runs GeoServer version 2.0.2 as a Tomcat web application, and serves the Acme and Whitewater township web maps.  Future plans include upgrading the GeoServer 2.0.2 installation on the map server to an OpenGeo Suite installtion, which runs a more recent version of GeoServer.