[mapserver-users] How can I set the output format of WFS getfeature request to text/html?

Rahkonen Jukka Jukka.Rahkonen at mmmtike.fi
Mon Sep 5 07:01:52 EDT 2011


Hi,

Probably the best I could do for you would be to encourage you do your own homeworks and read some basic documents about WFS and WMS, but ok, take these advice for free.

Text/html is not WFS outputformat. It is WMS GetFeatureInfo outputformat. Default outputformat for WFS is GML but additional ones can be added with OGR Output http://mapserver.org/output/ogr_output.html

In another question you asked about templates. They exist for configuring text/html output, for example WMS GetFeatureInfo when request is done with outputformat=text/html. It may be that configuring a text/html output for GetFeatureInso is not extremely well documented so you here is an example that is not tested but should be close to a working set.

Mapfile
LAYER
     NAME "GetFeatureInfo_layer"
     TYPE POLYGON
     STATUS ON
     DATA "GetFeatureInfo.shp"
     UNITS METERS
     DUMP TRUE
     DEBUG 5
     SIZEUNITS PIXELS
     TOLERANCE 3
     HEADER    "\data\template\GetFeatureInfo_header.html"
     TEMPLATE  "\data\template\GetFeatureInfo_template.html"
     FOOTER    "\data\template\GetFeatureInfo_footer.html"
     TOLERANCEUNITS PIXELS
     METADATA
            "wms_include_items" "GetFeatureInfo_items"
            "wms_title"    "GetFeatureInfo_layer"
            "wms_srs" "EPSG:4326"
     END
     PROJECTION
            "init=epsg:4326" 
     END
 END
 
Header template

<!-- MapServer Template -->
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"></meta>
<title>Maisemapiirrehaun tulos</title>
</head>
<body>
   <table>
      <caption><b>GetFeatureInfo Report</b></caption>
         <tbody>
            <th bgcolor=#CCCCCC>Title for ATTR1</th>
            <th bgcolor=#CCCCCC>Title for ATTR2</th>
            <th bgcolor=#CCCCCC>Title for ATTR3</th>
            <th bgcolor=#CCCCCC>Title for ATTR4</th>    

Body template

<!-- MapServer Template -->
<tr>
     <td>[item name=ATTR1 format="$value" escape=none]</td>
     <td>[item name=ATTR2 format="$value" escape=none]</td>
     <td>[item name=ATTR3 format="$value" escape=none]</td>
     <td>[item name=ATTR4 format="$value" escape=none]</td>
</tr>

Footer template

<!-- MapServer Template -->
    </tbody>
  </table>
 </body>
</html>


-Jukka Rahkonen-


 

> -----Alkuperäinen viesti-----
> Lähettäjä: mapserver-users-bounces at lists.osgeo.org 
> [mailto:mapserver-users-bounces at lists.osgeo.org] Puolesta jjwang
> Lähetetty: 5. syyskuuta 2011 5:11
> Vastaanottaja: mapserver-users at lists.osgeo.org
> Aihe: [mapserver-users] How can I set the output format of 
> WFS getfeature request to text/html?
> 
> The default output format is gml.
> How can I set the output format of WFS getfeature request to 
> text/html?
> I tried to add "outputformat=text/html" to the query string.
> But I got an error message "msWFSGetFeature(): WFS server 
> error. 'text/html'
> is not a permitted output format for layer 'nt', review wfs_formats
> setting."
> So I added *"wfs_formats" "text/html"* to the map file both 
> map level and
> layer level.
> Still doesn't work.
> 
> JJ
> 
> --
> View this message in context: 
> http://osgeo-org.1803224.n2.nabble.com/How-can-I-set-the-outpu
> t-format-of-WFS-getfeature-request-to-text-html-tp6759614p6759614.html
> Sent from the Mapserver - User mailing list archive at Nabble.com.
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
> 


More information about the mapserver-users mailing list