Geoserver As A Tool For Providing Networked Geospatial Environmental Data
Geoserver As A Tool For Providing Networked Geospatial Environmental Data
Geoserver As A Tool For Providing Networked Geospatial Environmental Data
As a geographer I once in a while end up being extremely positively surprised by innovations, both
commercial and from open source communities. Google Earth, which most of us know, has opened the world
of GIS in a completely new way for the general public. Geoserver is another door opener. Although it will not
find the same audience as Google Earth it helps by leveling the field when it comes to providing spatial data
by the use of servers. Where one earlier would need detailed knowledge (and funding) to set up ESRI
products, one may now do the same investing only a couple of hours of work. Within hours you could be
able to present spatial data within your own organization, or even externally using a web server.
This short article is a small review of Geoserver and some of its capabilities.
Web Map Services and Web Feature Services are tools for presenting spatial data both for internal and
external consumption. In this article I will use an example from my workplace to show how a protected areas
data set can be presented using Geoserver 2.0.2. Version 2.1 is just around the corner.
Should you have comments on this article do not hesitate to send me an email!
Sincerely!
Ragnvald Larsen
Layer ................................................................................................................................................................ 6
GeoWebCache .............................................................................................................................................. 12
Monitoring .................................................................................................................................................... 13
Recommendations ............................................................................................................................................ 13
What is Geoserver?
Geoserver is open source software that lets users share and edit geospatial data. It is freely available for
download and available for the Windows, Linux and MacOS platforms from the Geoserver website:
www.geoserver.org
The server is designed in Java. A separate Web service makes available the administrative interface and related
services. The server system is designed for interoperability and can by default publish the data from many data
sources (PostGIS, Oracle Spatial, ArcSDE, DB2, MySQL, Shape Files, GeoTIFF, GTOPO30, ECW, MrSID and
JPEG2000) using open standards. In addition, other data sources, such SQL server are supported through the
plug-in solutions.
Geoserver can deliver (convert) all of those data sources to formats such as KML, GML, Shape File, GeoRSS,
PDF, GeoJSON, JPEG, GIF, SVG, PNG and others. By means of WFS Transactional profile (WFS-T) one may edit
data that is linked to the Geoserver as a data source. Geoserver also handles a good selection of projections -
4,636 to be accurate.
In this article I will look into the installation and use of Geoserver with a couple of data sources.
The main page of the installed solution will look like after login:
No system is straightforward. You will experience challenges in your installation of this system. My experience
is that you should be able to overcome them. Remember to use the Geoserver documentation and also use
Google if you are having problems.
Before going to the test set up I will go through some Geoserver basics.
Geoserver basics
Terminology central to Geoserver are workspaces, stores, layers, styles and layer groups. Workspaces ar a bit
like folders, stores are related to one data source (shapefiles, databases, geotiff or other) and styles are ways to
represent those data on a map. This is more or less how they relate to each other:
Please note that one style can be used many times in different layers. The relationships between the
Geoserver objects are reflected in the menu system available on the left side of the Geoserver user.
Before we move on remember that OpenLayers is something completely different. You will often find these
two products used together, but while Geoserver is a server solution OpenLayers is a web front end tool for
presenting data from different map servers. These might be ESRI based or based on open source solutions like
Geoserver, MapServer ,PostGIS and other.
In order to test the solution wanted to establish a wms service based on a shapefile representing the
Norwegian protected areas:
NKV_2009_Alle_Shape_f.shp
st
The file contains all protected areas in Norway as per December the 31 2009 with a fair amount of
background information. We currently host this information using ESRI based solutions pulling data from
Microsoft SQL server.
It starts with a workspace. A Workspace is a simple page where you enter the basic meta-information. Think of
the workspaces as a folder system. The Geoserver documentation refers to it as a container system. There is a
name and a URL related to a workspace. A wokspace may therefore be:
serengeti
Geoserver documentation then advices that the related URL then could be:
http://www.tzgisug.org/serengeti
The next thing to register is a data source. In my case I selected a shapefile. When you make a link to a data
source in Geoserver, this is a defined as a store.
In this case, data is retrieved from a shapefile (with. PRJ, shx more available) placed in a subdirectory in the
data directory. This is the link to the geoserver layer done. Geoserver-layer is defined separately. Make sure to
keep the correct .prj files with your shapefile data set.
Layer
You start editing a layer by selecting data from a custom data store.
Two layers may have the same name as long as they are referred to different workspaces (folders).
A layer is externally referred to by using a combination of the workspace layer name. The layer above is named
as follows:
dirnat:wms_shape_vern_flate_klasser
Style Definitions
Style definitions in this version can only be edited as a text file. Styles are based on references to attributes in
the presented file.
To access the different styles Styles is selected from the left menu. This opens a page where all styles are
listed. Select a style for editing or choose to add a new one. This opens the following page:
1
The easiest way to create a style definition is to export a style from ArcGIS. A free plugin (Arc2Earth ) makes
this relatively easy. The limitation is that you can only create one SLD file at a time. It is not problematic if you
intend to create wms services since you usually tend to one layer at a time. Externally made files may be
uploaded from within this webpage.
An SLD file is exported with a graphics (where applicable). The SLD file is then uploaded or simply pasted into
the relevant style editor window. Any graphics files should be placed in styles directory on server. Another
2
solution available is to use open source software uDig this creates a more formal xml file which can also be
uploaded or pasted directly into the text window of style definitions. uDig currently does not allow for using
bitmaps as fill patterns in polygons.
Style Definitions of SLD has its challenges, but it seems okay to work with compared to Axl files which also
contain source data information, and more. It should be noted that the SLD files also be used as a style-
3
definition format for Mapserver .
Viewing solution
By selecting the layer preview in the left menu you get a list of available layer. Using OpenLayers is integrated
but not a part of the server solution. This makes it possible to look at the data set through a simplified map
browser. Other solutions are also available. Geoserver delivers these no matter what format the data source is
as such it also lends itself as a tool for converting data.
1
http://help.arc2earth.com/
2
http://udig.refractions.net/
3
http://mapserver.org/
Making an appropriate SLD file with the right categories was not all straightforward. But with examples from
the net, the use of export tools and udig it is within most peoples abilities to do this.
Extraction of data from shape file is also fine, although using adaptations certainly can be improved a great
4
deal. This is however on the client side, which in this case therefore is OpenLayers with a very basic
4
http://openlayers.org/
Options for viewing the data are available by pressing the options icon ( ). This is where one can try out
different options for tiling, picture formats (png, jpg, tiff, etc), map size and more.
The WMS standards makes sure that this works as with any other commercial wms/wfs-server. Just open your
favourite client and add the relevant layers.
The next step is to view your data. This works out of the box in QGIS and also works as expected in the ESRI GIS
desktop products.
This works, but is still somewhat slow. I suspect that tuning up the server for better memory allocation is
something one should take seriously.
GeoWebCache
Geoserver comes with GeoWebCache, a feature more often referred to as tile caching. Tile caching is a way of
preprocessing the map presented to a user. A map is usually made up of many small images - tiles. They are
seamlessly placed next to each other when a map is presented on the screen. Withouth the use of tilecaching
the tiles are made anew every time a part of the map is viewed in a particular resolution. With tile caching the
tiles are stored once and retrieved again later wothouth the necessary processing. This uses less of the server
5
http://www.dirnat.no/content.ap?thisId=347
The method is not advised for data sets which are often updated, and where the user need access to the latest
data sets.
Monitoring
Geoserver version 2.1 comes with monitoring included. This means that either real time use of the server or
historical data will be available for administrators.
Recommendations
Using Geoserver holds the key to making spatial data more available both internally and externally. The
solution is currently being used in many production environments.
Together with OpenLayers it is possible to set up a fully-fledged server and presentation system both
internally and externally.
Both being freely available and with a relatively low entry level for use it should be perfect for providing spatial
data both internally and externally.