[Geoserver-users] freemarker

Hi,

I'm trying to use ftl files in order to customize a getFeatureInfo output, but since it was very easy to do it for KML styling, I get a problem when I try to acces simply the value of an attribute with a formula like :

            ${attributename.value}

that I used with KML. It seems that in a getFeatureInfo customization, we can't access the specific value of an attribute in that way ... am I wrong ?

Regards

Laurent

Hi Laurent,

I wouldn't also mind on getting some further information on freemarker/geoserver. Actually, I am doing quite a same in these days than you. With the help of the getFeaureInfo I am embedding some html in the current page. I did it as follows:

<#list features as feature>
  <#list feature.attributes as attribute>
    <#if attribute.name='yourattributename'>

do something with ${attribute.value}

</#if>
  </#list>
</#list>

Seem to be working, although I don't quite get it. Can't it be done easier?

mika

laurent pierrre kirjoitti:

Hi,

I'm trying to use ftl files in order to customize a getFeatureInfo output, but since it was very easy to do it for KML styling, I get a problem when I try to acces simply the value of an attribute with a formula like :

            ${attributename.value}

that I used with KML. It seems that in a getFeatureInfo customization, we can't access the specific value of an attribute in that way ... am I wrong ?

Regards

Laurent

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
  

Hi Mika,

Yes that's a good idea although I was trying to use the same way as for KML.

Cheers

Laurent

Le 15 avr. 08 à 22:04, Lehtonen, Mika a écrit :

Hi Laurent,

I wouldn't also mind on getting some further information on freemarker/geoserver. Actually, I am doing quite a same in these days than you. With the help of the getFeaureInfo I am embedding some html in the current page. I did it as follows:

<#list features as feature>
<#list feature.attributes as attribute>
   <#if attribute.name='yourattributename'>

do something with ${attribute.value}

</#if>
</#list>
</#list>

Seem to be working, although I don't quite get it. Can't it be done easier?

mika

laurent pierrre kirjoitti:

Hi,

I'm trying to use ftl files in order to customize a getFeatureInfo output, but since it was very easy to do it for KML styling, I get a problem when I try to acces simply the value of an attribute with a formula like :

            ${attributename.value}

that I used with KML. It seems that in a getFeatureInfo customization, we can't access the specific value of an attribute in that way ... am I wrong ?

Regards

Laurent

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Hi Laurent,

Unfortunately it does not work quite the same as with KML. The reason is because with KML, the input to the template is a single feature, as with GetFeautreInfo, its a number of features. So first you must iterate through the features, and then get attributes. SOmethign like this:

<#list features as feature>
  'ATTRIBUTENAME' = ${feature.ATTRIBUTENAME.value}
</#list>

Hope that helps. There is more info available here:

http://geoserver.org/display/GEOSDOC/GetFeatureInfo+templates

-Justin

laurent pierrre wrote:

Hi,

I'm trying to use ftl files in order to customize a getFeatureInfo output, but since it was very easy to do it for KML styling, I get a problem when I try to acces simply the value of an attribute with a formula like :

            ${attributename.value}

that I used with KML. It seems that in a getFeatureInfo customization, we can't access the specific value of an attribute in that way ... am I wrong ?

Regards

Laurent

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

!DSPAM:4007,4805071e186641030819293!

--
Justin Deoliveira
The Open Planning Project
jdeolive@anonymised.com

2008/4/16 Justin Deoliveira <jdeolive@anonymised.com>:

Hi Laurent,

Unfortunately it does not work quite the same as with KML. The reason is because with KML, the input to the template is a single feature, as with GetFeautreInfo, its a number of features. So first you must iterate through the features, and then get attributes. SOmethign like this:

<#list features as feature>
‘ATTRIBUTENAME’ = ${feature.ATTRIBUTENAME.value}
</#list>

Hope that helps. There is more info available here:

Sure it helps :slight_smile: Thanks

Laurent