Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm trying to use the getfeatureinfo function of Openlayers with MapServer. When I click on a point on my map, I get the following error in Firebug:

<?xml version='1.0' encoding="ISO-8859-1" standalone="no" ?>
<!DOCTYPE ServiceExceptionReport SYSTEM "http://schemas.opengis.net/wms/1.1.1/exception_1_1_1.dtd">
<ServiceExceptionReport version="1.1.1">
<ServiceException code="LayerNotQueryable">
msWMSFeatureInfo(): WMS server error. Requested layer(s) are not queryable.
</ServiceException>
</ServiceExceptionReport>

I've included the javascript and mapfile that I am using. As far as I can tell, I have the correct arguments in my Mapfile but it does not appear to enable querying using getfeatureinfo. I'm also a little unclear on how my html templates should be structured or if they are essential for this.

This is the javascript (I am using OpenLayers 2.12):

    info = new OpenLayers.Control.WMSGetFeatureInfo({
    url: 'http://mysite.com/mapserv.cgi?MAP=points.map', 
    title: 'Identify features by clicking',
    queryVisible: true,
    eventListeners: {
        getfeatureinfo: function(event) {
           console.log(event.text)                  
        }
    }
});
map.addControl(info);
info.activate();

And this is my mapfile, points.map:

MAP
  IMAGETYPE      PNG
  EXTENT         -9780000 2770000 -8850000 3650000  
  SIZE           500 600
  SHAPEPATH      "/home/data"
  IMAGECOLOR     255 255 255
  PROJECTION
    "init=epsg:900913"
  END
  CONFIG          "MS_ERRORFILE" "/home/tmp/ms_error.txt"
  DEBUG 5         
  WEB
    METADATA
        "wms_title"           "WMS Demo Server"
        "wms_onlineresource"  "http://mysite.com/mapserv.cgi?MAP=points.map&"
        "wms_srs"             "EPSG:900913"
        "wms_enable_request"  "*"
        "ows_enable_request"  "*"
    END
  END

  ##### symbol definition
  SYMBOL
    NAME "circle"
    TYPE ellipse
    FILLED true
    POINTS
        1 1
    END
  END

  ####### layer
  LAYER 
    NAME            points
    CONNECTIONTYPE  POSTGIS
    CONNECTION      "host=localhost dbname=data user=postgres port=5432"
    DATA            "geom from points using unique gid using SRID=3086"
    HEADER          'head.html'  
    FOOTER          'foot.html'
    METADATA        
        "wms_enable_request" "*"    
        "gml_include_items" "all"
        "wms_include_items" "all"           
    END  
    STATUS          ON
    TYPE            POINT
    PROJECTION
        "init=epsg:3086"
    END
    CLASS
      NAME 'point symbols'
      STYLE
        SYMBOL "circle"
        COLOR         100 100 100
        OUTLINECOLOR  10  10  10
        SIZE 50
      END
    END
  END    
END 

My template files are very basic - just <html><body> for the HEADER and </body></html> for the FOOTER.

Where am I going wrong in this overall process?

share|improve this question
add comment

1 Answer

If I have understood your question, you have created the HEADER and the FOOTER files, but not the TEMPLATE one. The latter file is mandatory, and in your scenario it 'generates' the contents of HTML's body.

Besides, inside the LAYER object of your mapfile there should also be a reference to the template file, given via TEMPLATE.

For point based queries, it is advisable you also include inside the LAYER object TOLERANCE and TOLERANCEUNITS.

share|improve this answer
    
ah ok. Thanks for the suggestion. I just added TEMPLATE "body.html" into my mapfile and created an empty file 'body.htmll'. I'm still getting the error that my layer is not queryable though. –  djq Oct 9 '12 at 0:13
    
Given that you are using MapServer 5, try to set DUMP to "true" in the LAYER object; by default, DUMP is set to "false". –  dariapra Oct 9 '12 at 0:31
    
DUMP "true" appears to be deprecated mapserver.org/mapfile/layer.html (and pink tiles were overlaid on map). –  djq Oct 9 '12 at 2:21
    
According to documentation (goo.gl/lSKKc), DUMP is deprecated in MapServer version 6 and later, not in MapServer version 5. –  dariapra Oct 9 '12 at 11:23
    
I'm using the most recent Mapserver version (6.0.3) –  djq Oct 9 '12 at 14:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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