OpenGeo Suite is a complete geospatial platform for managing data and building maps and applications. In the newest version, Boundless makes it even easier to build and deploy applications by adding better data management tools to QGIS and improving the SDK with support for OpenLayers 3.
This post is the first of a series of posts describing how to create complete, enterprise-grade web applications using these and other features. While we’ve previously shown how to configure OpenGeo Suite from QGIS, this post will describe a typical workflow to show how easy it is to analyze and style on the desktop using QGIS and then publish to the web using GeoServer. Our next post will describe how to use this data to create an application to visualize this data.
Our first demo application, Ice3, is a mapping application that visualizes changes in Arctic sea ice over a 33 year period (1980-2013). The maximum August sea ice extent is shown in the timeline slider beneath the map. Additionally, an outline of the 30-year (1981-2010) median August sea ice extent is included for comparison. All data is from the National Snow & Ice Data Center, a source for consistently processed ice extent and concentration images and data values since 1979. A third dataset showing the average snow extent in August (1967-2004) is also included for reference.
Preparing the Data
The workflow that we have to execute involves loading and reprojecting several layers into the same coordinate reference system (CRS), styling them, and then publishing them to GeoServer. It is not strictly necessary to reproject layers, as GeoServer can do that on the fly, but if we expect most requests to use a given CRS then reprojecting them in advance will avoid having to reproject them at request time and thus make our service more performant. In order to show the capabilities of GeoServer, other posts in this series will use layers in their original CRS, but in this one we will be reprojecting them to a common one using QGIS. We will be using the following datasets:
- Natural Earth
- Base map
- EPSG 4326
- Sea Ice Index (August)
- Median (1981-2010) polyline
- Extent (1980-2013 every 3 years) polygons, 12 data layers
- Shapefiles from University of Colorado Boulder
- EPSG 3413
- Atlas of the Cryosphere
- Average Snow Extent in August (1967-2004)
- WMS Connection
Setting up GeoServer
Before preparing our layers, we need configure the GeoServer catalog. From the QGIS plugin, we can connect to our GeoServer instance and create a new workspace that will contain our layers.
Base map layer
To reproject the Natural Earth base map layer into a polar projection, we will use the Reproject vector layer algorithm in the Processing toolbox. Doing so will generate a new layer in the EPSG:3408 CRS, which will be our target for all layers.
We can then define a style for the layer on the layer properties dialog. Once the layer is ready to be published, we can drag and drop the layer into the desired catalog and workspace using the QGIS plugin.
Average snow extent layer
The average snow extent layer is based on an an existing WMS service. Currently, cascading a WMS service can only be configured from the GeoServer administration interface, but an upcoming release of OpenGeo Suite will make it possible to define a new connection in QGIS…
…and then add a corresponding layer from the list provided by that service.
Sea ice layers
Preparing and publishing the sea ice layers is the most complex part, since there is a large number of them. We will show how to automate the process to simplify it.
All layers will have the same styling, since we do not plan to show them together, but as different snapshots. That means we can reuse the style definition. We style one of the layers and then save the style as a QGIS QML file.
The operation that we need to perform for all the layers in the sea ice set is reprojecting them and then applying the style that we have just saved. To make it easier to run repeatedly, we can define this small workflow as a model in the QGIS processing framework. This is what the model should look like:
The reprojection algorithm uses EPSG:3408 as the destination CRS, and the Style vector layer algorithm uses our QML style file.
To run this model in all of our layers, we can run it as a batch process. Selecting the sea ice layers as inputs for the batch process will generate a new set of reprojected and styled layers, ready to be published to GeoServer.
Another way of using our model is by setting it as a pre-publish hook. Our QGIS plugin makes it possible to define an operation to be performed to any layer as it is published. If we set our model to run when publishing then there is no need to run the batch process. Simply publish the set of sea ice layer from our QGIS plugin by dragging and dropping them on the destination workspace item they will be reprojected and styled as they’re published.
Preparing the cache
Once all layers are published, we can also create the corresponding cache layers and seed the cache from the QGIS plugin. To create a cache layer, just right-click on the GeoWebCache item and select the GWC layer and then specify the layer to cache.
Or, even easier, just drag a Geoserver layer into the GeoWebCache item. You can then cache the layer to its full extent, or, if you just want to cache a given region, define its bounding box by clicking on Define in canvas button and then dragging and dropping the QGIS map to select the bounding box.
Now we have configured all the layers for our Ice3 demo application by reprojecting and publishing from QGIS to GeoServer. In the next post we will see how to create an interface for the application using OpenLayers 3.