Publishing GeoPackage to GeoServer Using QGIS

Recently, I had the occasion to attempt to generate an OGC GeoPackage from QGIS and publish it using GeoServer. The use case was fairly straightforward. I had been given data in GML format and needed to publish it. For many valid reasons (such as lack of spatial indexing), GeoServer does not natively support publishing GML data. As a result, I need to convert it to something that GeoServer did support.

QGIS opened and displayed the data easily and, from there, I could export it into any number of formats. (Or I could have used OGR.) The feature attributes had very long names and I didn’t want to lose that richness by exporting to shapefile. I was trying to keep my server-side life simple, so I was hoping to avoid setting up an RDBMS data store for this purpose. It was then that I noticed QGIS supports exporting to GeoPackge, so I decided to give it a go.

For purposes of this post, I am using a shapefile of building footprints of Leonardtown, Maryland. The process is the same for a GML file, however.

As shown below, you initiate the process like any other by right-clicking and choosing “Save As…” in the context menu.


In the resulting dialog box, you set your export options, such as output file name. The dialog below is showing defaults, which were sufficient for this post.


Once the GeoPackage file is created, it’s time to publish it in GeoServer. GeoServer doesn’t support GeoPackage out of the box, requiring you to install the WPS extension and the GeoPackage extension in that order. The installation instructions are well-document here, so I won’t repeat them in this post.

Once these extensions are installed and running, you will be able to choose a GeoPackage as a data store. Simply choose “Stores” under the “Data” heading in the left column of the GeoServer administration page. The choose to create a new data store and select “GeoPackage” under “Vector Data Sources.” There is also a GeoPackage choice for raster data stores, but this post will not address that.


You then need to configure the new GeoPackage data source. In the example below, everything but the file name is a default.


After the data source has been set up, you can publish one or more layers from your GeoPackage. In this case, I only had one layer. Click “Publish” and set the various layer parameters as you see fit.


Once you have configured and published your layer, you can use the GeoServer “Layer Preview” tool to verify it. The image below shows a portion of my layer, as well as the attribute data for one of the buildings. In this case, I used the Openlayers option to view and interact with my data. It is set up to access the layer via WMS, GeoServer supports numerous options for accessing the data.


I needed to accomplish this for a project-related task. The primary focus of the project is a software development task and GeoServer is basically part of the supporting infrastructure. The ease with which I was able to accomplish this kept me from getting diverted. I’ve recently commented on how easy it has been to work with the latest versions of Esri’s server products after a long hiatus from them. I found the process to be equally smooth with this toolset and it’s encouraging to see so many easy-to-use options at the fingertips of GIS practitioners.