I'm using OpenLayers 2.0 and MapServer.

I would query MapServer and I would that it return to me a JSON file:

On my page, I generated dynamic URL as:


In the file MAP.map (my Mapserver) I defined:

METADATA section:

  "wms_feature_info_mime_type" "text/plain"
  "wms_feature_info_mime_type" "text/html"
  "wms_feature_info_mime_type" "application/json"
  "wms_feature_info_mime_type" "application/vnd.ogc.gml"
  "wms_feature_info_mime_type" "gml"

LAYER section: HEADER "/template/header.ftl"


TEMPLATE "/template/content.ftl"

    id: [TANK_ID],
    attribute: [DESCRIPTION]

FOOTER "/template/footer.ftl"


If I launch the URL in my browser:

GetFeatureInfo results:

Layer 'TANK'
  Feature 100: 

If I convert INFO_FORMAT in text/html, it works fine.


  • 1
    You ask for INFO_FORMAT=text/plain and you receive plain text which is expected result. – user30184 Dec 9 '14 at 13:06
  • Ok, in the case, what is the correct format? I tried with info_format=application/json, but the server generated this error: msWMSFeatureInfo(): WMS server error. Unsupported INFO_FORMAT value (info_format=application/json). – robertino Dec 9 '14 at 13:45
  • 1
    You can have only one "wms_feature_info_mime_type" in metadata. For a list you should probably use "wms_getfeatureinfo_formatlist". Checking GetCapabilities is, as always with WMS, the first thing to do. Does is list application/json as supported info format? Before your desired format is listed it is wasting your time to do anything else. – user30184 Dec 9 '14 at 14:09
  • I use GetCapabilities: <GetFeatureInfo> <Format>application/json</Format> <Format>application/vnd.ogc.gml</Format> <Format>text/plain</Format> <DCPType> <HTTP> <Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://vertigo-w7:8080/fcgi-bin/mapserv.exe?map=c:/ms4w/apps/RAM/RAM.map&amp;"/></Get> <Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://vertigo-w7:8080/fcgi-bin/mapserv.exe?map=c:/ms4w/apps/RAM/RAM.map&amp;"/></Post> </HTTP> </DCPType> </GetFeatureInfo> – robertino Dec 9 '14 at 14:50
  • Ok, that means that info_format=application/json should be supported. How have you defined the corresponding outputformat? See example from mapserver.org/output/template_output.html. – user30184 Dec 9 '14 at 15:09

Your Answer

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

Browse other questions tagged or ask your own question.