2

We are using GeoServer (version 2.12.1) to deliver a rich HTML-attribute on the getfeatureinfo request. This allows us to add a table when the format requested is in HTML. This will of course not look nice when requesting the getfeatureinfo in any other format. But here it is not relevant.

In the table we deliver in the attribute we have a link to a factsheet. It would seem the link is rewritten so that it now looks like this:

https://maps.ourdomain.xx/geoserver/ourworkspace/%22https://factsheet.factsheetprovider.xx/?id=vv01234%22

%22 equals ", so this is what it says...

https://maps.ourdomain.xx/geoserver/ourworkspace/"https://factsheet.factsheetprovider.xx/?id=vv01234"

My freemarker template (content.ftl) look like this:

<table class="featureInfo">
  <caption class="featureInfo">Informasjon om prioriterte områder</caption>
<tr>
<#list features as feature>
  <#list feature.attributes as attribute>
        <#if attribute.name=="html_content">
        <td align="left">${attribute.value}</td>
      </#if>
  </#list>
  </tr>
</#list>
</table>
<br/>

Seems like https://maps.ourdomain.xx/geoserver/ourworkspace/ is added by GeoServer.

Is there a way around this? What am I missing?

  • 1
    Please add the relevant freemarker template – Ian Turton Sep 13 at 15:47
  • Thanks Ian. Done :-) – ragnvald Sep 13 at 16:18
  • I have tried using the FTL-function replace without much help. Seems like in 2.12.1 it just "hangs" with the following HTML/FTL: <td align="left">${attribute.value?replace("maps.ourdomain.xx/geoserver", "")}</td> – ragnvald Sep 16 at 20:52
1

When GeoServer finds a quote sign (") in an href-value it assumes this is a variable and not a complete http-reference. It will add this "variable" to the Namespace URI in your GeoServer workspace.

Your original link will remain if you produce your html attribute value with without a quote sign. It will also work if you are using a single quote (').

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.