Nasrul Hazim Bin Mohamad

GeoServer – GetFeatureInfo Template Data Model (structure)


Extend from this GeoServer – Custom Get Feature Info Display

Knowledge requirement – Freemaker

The standard template files is header.tpl, content.tpl, footer.tpl.

header.tpl usually where JavaScript, CSS, meta tag, title placed here.

footer.tpl where you put your HTML page footer, Copyright, etc.

content.tpl where we going to iterate through all the features to display interactive UI. But here, I’m going to explain the structure of all available variables.

features (array of Feature)
		- fid
		- typeName
		- attributes
			-> name
			-> type
			-> isGeometry
			-> value
		- type
			-> name
			-> title
			-> abstract
			-> description
			-> keywords
			-> metadataLinks
			-> SRS
			-> nativeCRS
type (object of Feature Map)
	- name
	- attributes
		-> name
		-> type
		-> isGeometry

Accessing the variables as following:

<!-- Accessing Feature Type Name -->

<!-- Accessing Features at index 0 and assign to a variable named feature -->
<#assign feature = features[0]>

<!-- Get feature's attributes values and assign to a variable named attrs -->
<#assign attrs = feature.attributes>

<!-- Display an attribute -->

The result may display as below:

This is type name

some field name value


GeoServer, OpenLayers, PostGis – WFS-T


A good tutorial on WFS-T. Didn’t try it yet, but will try it soon.

GeoServer – Custom Get Feature Info Display

GeoServer - Custom Get Feature Info Display

GeoServer – Custom Get Feature Info Display

GeoServer enabled users to set custom display for feature info. Read this and this for more details.

Here i’m just telling where to add the custom display.

Please add ‘content.ftl‘ for the following under GEOSERVER_DATA_DIR/workspaces/…

  1. Feature type specific template:
    • <workspace>/<datastore>/<featuretype>/content.ftl
  2. Store specific template:
    • <workspace>/<datastore>/content.ftl
  3. Workspace specific template:
    • <workspace>/content.ftl
  4. Global:
    • content.ftl
  5. GeoServer classpath and load the default template