I have created the following global template for my text/html GetFeatureInfo
response and it's working great with one layer:
{
"layer":
{
"name": "${type.name?js_string}",
"features":
[
<#list features as feature>
{
<#list feature.attributes as attribute>
<#if !attribute.isGeometry>
"${attribute.name?js_string}":
"${attribute.value?js_string}"<#if
attribute_has_next>,</#if>
</#if>
</#list>
}<#if feature_has_next>,</#if>
</#list>
]
}
}
(header.ftl simply contains the open bracket for an array [ and footer.ftl
the closing bracket ] )
However, if I query GetFeatureInfo with two or more layers the template is
repeated and the JSON is no longer valid, as there is no comma separating
the layer objects in the array.
I tested adding <#if collection_has_next>,</#if> and <#if
feature_collection_has_next>,</#if> to the end of the template but it
errored both times.
Is there any way to know that the template is going to be repeated, and
create valid JSON for multiple feature collections? Any advice much
appreciated.
Thanks
--
View this message in context:
http://osgeo-org.1560.n6.nabble.com/GetFeatureInfo-JSON-template-multiple-feature-collections-and-trailing-commas-tp4963925.html
Sent from the GeoServer - User mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users