Ice Cubed (Part 1): Data Preparation with QGIS

Victor Olaya

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.

Ice3

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:

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.

newws

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.

reproject

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…

wmsconn

…and then add a corresponding layer from the list provided by that service.

wmslayer

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.

savestyle

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:

model

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.

batch

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.
hook

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.

Clipboard01

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.

Clipboard02

Conclusion

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.

EmailTwitterFacebookGoogle+tumblrLinkedIn

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>