geoserver as a tool for providing networked geospatial environmental...

13
Geoserver review Page 1 Geoserver as a tool for providing networked geospatial environmental data Version October 31 st 2010 By Ragnvald Larsen, Geographer ([email protected]) 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

Upload: vunguyet

Post on 10-Nov-2018

228 views

Category:

Documents


0 download

TRANSCRIPT

Geoserver review Page 1

Geoserver as a tool for providing networked geospatial environmental data

Version October 31st 2010

By Ragnvald Larsen, Geographer ([email protected])

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

Geoserver review Page 2

Contents

What is Geoserver? ............................................................................................................................................. 3

Installation of a test solution .............................................................................................................................. 3

Geoserver basics ................................................................................................................................................. 4

Workspace and data stores ............................................................................................................................. 5

Layer ................................................................................................................................................................ 6

Style Definitions .............................................................................................................................................. 7

Viewing solution .................................................................................................................................................. 8

WMS - Web Map Services ................................................................................................................................. 10

Other examples of functionality ....................................................................................................................... 12

GeoWebCache .............................................................................................................................................. 12

Monitoring .................................................................................................................................................... 13

Recommendations ............................................................................................................................................ 13

Geoserver review Page 3

Figure 1.: This is what Geoserver looks like before you log in.

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.

Installation of a test solution

The software used in this demonstration was downloaded and installed on a test server running MS Windows Server 2003 Standard Edition, Service Pack 2. Geoserver supports Windows, Mac OS-X, Linux and an also sports

an OS independent binary.

Geoserver review Page 4

The installation was pretty forward. The solution installs the java runtime to fit the operating environment. Default setup implies that the data directory is a subdirectory of the application directory (C: \ Program Files \ GeoServer 2.0.2. After installation, the server was rebooted and the server ran nicely.

The main page of the installed solution will look like after login:

Figure 2. Main page for Geoserver after install

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:

Geoserver review Page 5

Figure 3. The workspace, store, layer and style hierarchy

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.

Figure 4. Menu tab contains important data links.

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.

Workspace and data stores

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

The file contains all protected areas in Norway as per December the 31st

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.

Geoserver review Page 6

Figure 5. Establishment of a vector data source

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.

Figure 6. Layout of data layer

Two layers may have the same name as long as they are referred to different workspaces (folders).

Geoserver review Page 7

The next operation is to publish information. Select the correct projection and define bounding boxes based on this. Choose an appropriate style definition or make one. As you can see automatically generated a legend based on the style definition you choose. This may also be obtained in other contexts.

Figure 7. Publication of layer

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:

Geoserver review Page 8

Figure 8. Editing style formatting information (SLD).

The easiest way to create a style definition is to export a style from ArcGIS. A free plugin (Arc2Earth1) 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 solution available is to use open source software uDig

2 – 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-definition format for Mapserver

3.

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/

Geoserver review Page 9

Figure 9. Selecting the preview of data from geoserver.

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 people’s abilities to do this.

Figure 10. Layout of protected areas in Norway with classes.

Extraction of data from shape file is also fine, although using adaptations certainly can be improved a great deal. This is however on the client side, which in this case therefore is OpenLayers

4 with a very basic

4 http://openlayers.org/

Geoserver review Page 10

implementation to ensure easy access to data available on the server. Ordinary retrieval using ArcGIS or other GIS tools works fine. It may need some refinement in the setup of the projection to be made available.

Figure 11. Information about protected areas, in Hardangervidda.

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.

WMS - Web Map Services

One may of course also use clients like ArcGIS, QGIS and other to view the available data on geoserver. Geoserver provides both WMS and WFS formats. WFS-T (transactional WFS) is also available.

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.

Geoserver review Page 11

Figure 12.: connecting to the Geoserver using QGIS 1.5

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.

Figure 13.: Viewing Geoserver WMS data using QGIS 1.5

Geoserver review Page 12

Making sure that the correct projections are available and chosen is something which might be a challenge.

Other examples of functionality

In addition to the solution documented above, I have looked at how geotiff can be used as a basis. The experience is that one should use the tile-caching options for such data. 100-meter routes from Satveg project

5

based on the tiff file Norge25kl_100-t1.tiff

Figur 14. Geoserver showing Norway maps Satveg

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

Geoserver review Page 13

resources and maps can be provided faster. With preprocessing a whole range of tiles are made for a defined area by request of the server administrator.

The method is not advised for data sets which are often updated, and where the user need access to the latest data sets.

Figure 15. Tile caching setup

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.