Custom Template Content.ftl

Hello,
I need a separate template for a layer that is in a geopackage. Where do I have to store the content.ftl and how do I name it for a layer from a geopackage?

The layer is called “beleuchtungsanlagen” and is included in the geopackage “strassenbeleuchtung”.

I have already tried many variations and packed them in various folders, but so far I have had no success.

Hello @ubrede

It is hard to explain where to store the content.ftl file since it is kind of a search path.

The idea is that the layer will find the template that is “closest”:

  • GEOSERVER_DATA_DIR/workspaces/<workspace>/<datastore>/<feature type>/content.ftl
  • GEOSERVER_DATA_DIR/workspaces/<workspace>/<datastore>/content.ftl
  • GEOSERVER_DATA_DIR/workspaces/<workspace>/content.ftl
  • GEOSERVER_DATA_DIR/workspaces/content.ftl
  • GEOSERVER_DATA_DIR/templates/content.ftl
  • defaults built into geoserver.war

So if your “geopackage” is the <datastore> folder above. If you add to ``/content.ftl` the template will apply to all the layers in that geopackage.

If your layer is <datastore>/<feature type>/ above, then adding <datastore>/<feature type>/content.ft will apply to only that one layer.

This is described in the user guide here.

  • Can you read and provide feedback please?
  • I would like to know if the explanation makes sense, as I need to provide a similar set of instructions for ogcapi-features.