The TEXT/HTML format
One of the ways you can get information from GeoServer about features you click on is by querying WMS with a point and getting a list of surrounding features.
The output format can be anything. The INFO_FORMAT
should be text/HTML.
Using the GetFeatureInfo freemarker template
We are going to customize the template for freemarker output. With the following steps, you can have a different layout for information:
- Go to the
OpenLayers
demo fortopp:states
. - After the map loads, click on a state. The layer information about that state loads under the map. Consider the following example for clicking on
Alabama
:
- Now, examine the URL that was called. The
INFO_FORMAT=text/html
outputs the feature as an HTML string by default:
http://localhost:8080/geoserver/topp/wms? REQUEST=GetFeatureInfo&EXCEPTIONS=application/vnd.ogc. se_xml&BBOX=-139.848709,18.549282,-51.852562,55.77842&SERVICE= WMS&INFO_FORMAT=text/html&QUERY_LAYERS=topp:states...