Bootstrap, CSS, CSS3, Data Structure, Development, GeoServer, HTML, HTML5, JavaScript, jQuery, PHP

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)
	[0]
		- fid
		- typeName
		- attributes
			-> name
			-> type
			-> isGeometry
			-> value
		- type
			-> name
			-> title
			-> abstract
			-> description
			-> keywords
			-> metadataLinks
			-> SRS
			-> nativeCRS
	[n]
	
type (object of Feature Map)
	- name
	- attributes
		-> name
		-> type
		-> isGeometry
**/

Accessing the variables as following:

<!-- Accessing Feature Type Name -->
<h3>${type.name}</h3>

<!-- 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 -->
<p>${attr.someFieldName.value}</p>

The result may display as below:

This is type name

some field name value

Reference: http://docs.geoserver.org/2.1.4/user/tutorials/freemarker.html

Leave a Reply

Your email address will not be published. Required fields are marked *

4 − two =