[Geoserver-users] content.ftl order of attributes mixed up

I am having a problem with attribute orders while using FTL. My sweet content.ftl file looks like this:

<#list features as feature>

<#list feature.attributes as attribute>

<#if !attribute.isGeometry>

<#if attribute.name=“art_norsk”>

</#if>

<#if attribute.name=“art_latins”>

</#if>

<#if attribute.name=“km2”>

</#if>

</#if>

</#list>

</#list>

Art Latin Areal (km2)
${attribute.value} ${attribute.value} ${attribute.value}

It produces this getfeatureinfo for html:



Art



Latin



Areal (km2)



6298.26717326



Bjørn



Ursus arctos

The feature attributes (from a shapefile) is presented in the order of the data within the shapefile (km2, art_norsk, art_latins), and not according to my content.ftl-script (art_norsk, art_latins, km2). The shapefile in question is available here:

· http://db.tt/M3Nfcvbb

Bug or human error somewhere on my side?

http://db.tt/M3Nfcvbb

Cheers,

Ragnvald

PS Tomorrow we will start serving geoserver wms services officially J

Senior Engineer, Environmental data section

Tlf: +47 73 58 05 64
Mob: +47 92 42 15 40

The Norwegian Directorate for Nature Management
www.dirnat.no

On 31 October 2011 15:15, Ragnvald Larsen <Ragnvald.Larsen@…3709…> wrote:

I am having a problem with attribute orders while using FTL. My sweet content.ftl file looks like this:

<#list features as feature>

<#list feature.attributes as attribute>

<#if !attribute.isGeometry>

<#if attribute.name=“art_norsk”>

</#if>

<#if attribute.name=“art_latins”>

</#if>

<#if attribute.name=“km2”>

</#if>

</#if>

</#list>

</#list>

Art Latin Areal (km2)
${attribute.value} ${attribute.value} ${attribute.value}

It produces this getfeatureinfo for html:



Art



Latin



Areal (km2)



6298.26717326



Bjørn



Ursus arctos

The feature attributes (from a shapefile) is presented in the order of the data within the shapefile (km2, art_norsk, art_latins), and not according to my content.ftl-script (art_norsk, art_latins, km2). The shapefile in question is available here:

User error I’m afraid - if you want to specify the order for your output you need to loop through the attributes each time just selecting the one you want at that point.
<#list feature.attributes as attribute>

<#if !attribute.isGeometry>

<#if attribute.name=“art_norsk”>

${attribute.value}

</#if>

</#if>

</#list>

<#list feature.attributes as attribute>

<#if !attribute.isGeometry>

<#if attribute.name=“art_latins”>

${attribute.value}

</#if>

</#if>

</#list>

<#list feature.attributes as attribute>

<#if !attribute.isGeometry>

<#if attribute.name=“km2”>

${attribute.value}

</#if>

</#if>

</#list>

Ian