GeoPackage As Output

GeoPackage WMS Output Format

Any WMS GetMap request can be returned in the form of a GeoPackage by specifying format=geopackage as output format (see WMS output formats). The returned result will be a GeoPackage file with a single tile layer.

The following additional parameters can be passed on using format_options:
  • tileset_name: name to be used for tileset in GeoPackage file (default is name of layer(s)).

  • min_zoom, max_zoom, min_column, max_column, min_row, max_row: set the minimum and maximum zoom level, column, and rows

  • gridset: name of gridset to use (otherwise default for CRS is used)

GeoPackage WFS Output Format

Any WFS GetFeature request can be returned as a GeoPackage by specifying format=geopackage as output format (see WFS output formats). The returned result will be a GeoPackage file with a single features layer.

GeoPackage WPS Process

A custom GeoPackage can be created with any number of tiles and features layers using the GeoPackage WPS Process (see Process Cookbook).


While the process generates a compliant GeoPackage, some abilities like generalization, style and part of the metadata export are based on unofficial extensions discussed in the Testbed 16 GeoPackage engineering report.

The WPS process takes in one parameter: contents which is an XML schema that represents the desired output.

General outline of a contents scheme:

<geopackage name="mygeopackage" xmlns="">
    <features name="myfeaturelayer" identifier="L01">
        <description>describe the layer</description>
        <!-- ... -->

    <tiles name="mytileslayer" identifier="L02">
        <description>describe the layer</description>
        <!-- ... -->

Each GeoPackage has a mandatory name, which will be the name of the file (with the extension .gpkg added). Each layer (features or tiles) has the following properties:

  • name (mandatory): the name of the layer in the GeoPackage;

  • identifier (optional): an identifier for the layer;

  • description (optional): a description for the layer;

  • srs ( mandatory for tiles, optional for features): coordinate reference system; for features the default is the SRS of the feature type;

  • bbox ( mandatory for tiles, optional for features): the bounding box; for features the default is the bounding box of the feature type.

Outline of the features layer:

<features name="myfeaturelayer" identifier="L01">
    <propertynames>property1, property2</propertynames>
    <sort xmlns:fes="">
Each features layer has the following properties:
  • featuretype (mandatory): the feature type

  • propertynames (optional): list of comma-separated names of properties in feature type to be included (default is all properties)

  • filter (optional): any OGC filter that will be applied on features before output

  • indexed (optional): include spatial indexes in the output (true/false)

  • styles (optional): include styles in the output (true/false). The exported structure uses the portrayal and semantic annotation extensions, as described in Testbed 16 E/R

  • metadata (optional): embed metadata referred by the layer metadata links into the GeoPackage (true/false). The base metadata tables are filled with contents, while semantic annotations might be used to add extra information about the metadata itself.

  • overviews (optional): adds overview tables that can speed up rendering. See more at Creating generalized tables

  • sort (optional): a filter encoding fes:SortByType which allows sorting the table contents on one or more attributes. If the chosen attribute is a geometry, the table will be sorted on its GeoHash, improving access locality when using spatial indexes.

Outline of the tiles layer:

<tiles name="mytileslayer" identifier="L02">
    <layers>layer1, layer2</styles>
    <styles>style1, style2</styles>
Each tiles layer has the following properties:
  • layers (mandatory): comma-separated list of layers that will be included

  • styles, sld, and sldbody are mutually exclusive, having one is mandatory
    • styles: list of comma-separated styles to be used

    • sld: path to SLD style file

    • sldbody: inline SLD style file

  • format (optional): mime-type of image format of tiles (image/png or image/jpeg)

  • bgcolor (optional): background colour as a six-digit hexadecimal RGB value

  • transparent (optional): transparency (true or false)

  • coverage (optional)

  • minzoom, maxzoom, minColumn, maxColumn, minRow, maxRow (all optional): set the minimum and maximum zoom level, column, and rows

  • gridset (optional): see following

Gridset can take on two possible (mutually exclusive) forms:


where the name of a known gridset is specified; or a custom gridset may be defined as follows:

        <!-- ... -->

Creating generalized tables

The process can create generalized tables, as described in Testbed 16 generalized tables extension.

Generalized tables are sidecar tables that typically contain less records than the original table, with the option to also generalize their geometry. These are created by adding a list of overview directives in a feature layer description, each one containing:

  • name (mandatory): the generalized table name

  • distance (optional): the generalization distance to create simplified geometries

  • scaleDenominator: the scale denominator at which the table starts being used, in preference to the original table, and other tables with a lower scale denominator value

  • filter (optional): an OGC filter removing features that are not meant to be rendered at the target scale denominator

Here is an example:

<features name="woodland" identifier="woodland">
      <filter xmlns:fes="">
      <filter xmlns:fes="">