I'm attempting to display some properties from the points on my map. I'm using the example provided on the geoserver site: http://openlayers.org/en/latest/examples/getfeatureinfo-image.html?mode=raw. When I click on my map, it opens up a dialog box, but its empty. I checked the logs and nothing seems unusual other than the fact that no matter where I click on the map, pixelX and pixelY are always 50, which seems to be the center point, as the width and height in the request are both 101.


    <title>WMS GetFeatureInfo (Image Layer)</title>
    <link rel="stylesheet" href="https://openlayers.org/en/v4.2.0/css/ol.css" type="text/css">
    <!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
    <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"></script>
    <script src="https://openlayers.org/en/v4.2.0/build/ol.js"></script>
    <div id="map" class="map"></div>
    <div id="info">&nbsp;</div>
      var wmsSource = new ol.source.ImageWMS({
        url: 'http://localhost/geoserver/cite/wms',
        params: {'LAYERS': 'cite:points'},
        serverType: 'geoserver',

      var wmsLayer = new ol.layer.Image({
        source: wmsSource

      var view = new ol.View({
        center: [0, 0],
        zoom: 1

      var map = new ol.Map({
        layers: [wmsLayer],
        target: 'map',
        view: view

      map.on('singleclick', function(evt) {
        document.getElementById('info').innerHTML = '';
        var viewResolution = /** @type {number} */ (view.getResolution());
        var url = wmsSource.getGetFeatureInfoUrl(evt.coordinate, viewResolution, 'EPSG:4326', {'INFO_FORMAT': 'text/html'});
        if (url) {
          document.getElementById('info').innerHTML = '<iframe seamless src="' + url + '"></iframe>';

      map.on('pointermove', function(evt) {
        if (evt.dragging) {
        var pixel = map.getEventPixel(evt.originalEvent);
        var hit = map.forEachLayerAtPixel(pixel, function() {
          return true;
        map.getTargetElement().style.cursor = hit ? 'pointer' : '';


Request: getFeatureInfo
    BaseUrl = http://localhost:80/geoserver/
    Exceptions = application/vnd.ogc.se_xml
    FeatureCount = 1
    Get = false
    GetMapRequest = 
GetMap Request
 version: 1.3.0
 output format: image/png
 width height: 101,101
 bbox: SRSEnvelope[-267350.5296874754 : 7638072.6836785935, 2.086165940819164E7 : 2.876708262155771E7]
 layers: cite:points
 styles: customPoint
     InfoFormat = text/html
     PropertyNames = null
     QueryLayers = [org.geoserver.wms.MapLayerInfo@f58b334c]
     RawKvp = {CRS=EPSG:4326, FORMAT=image/png, INFO_FORMAT=text/html, I=50, STYLES=, J=50, WIDTH=101, HEIGHT=101, LAYERS=cite:points, REQUEST=GetFeatureInfo, BBOX=-267350.5296874754,20861659.40819164,7638072.6836785935,28767082.62155771, VERSION=1.3.0, SERVICE=WMS, QUERY_LAYERS=cite:points, TRANSPARENT=true}
     Request = GetFeatureInfo
     RequestCharset = null
     Version = 1.3.0
     XPixel = 50
     YPixel = 50

The fact the the example doesn't work makes me think it has something to do with how I set up the layer or server, but I haven't found anything yet.

  • does it work with a default layer e.g. topp:states? – Ian Turton Jul 11 '17 at 8:14
  • no, same behavior with topp:states – Evan Jul 11 '17 at 13:49
  • 1
    Is there anything (relevant) in the browser's console window (press F12)? Maybe you could also add the exact GetFeatureInfo url that your browser is sending, and possibly the capabilities document of the WMS server. – Berend Oct 5 '18 at 14:56
  • CRS = EPSG:4326 but bbox is not expressed in decimal degrees, that seems very wrong – nmtoken May 6 '20 at 12:58

have the same kind of problem.I think it's geoserver that requires activating wms service locally. Still not sure for 100% but creating new workspace and publishing it should solve the problem, also remember to check wms checkbox while publishing

  • The issue though is only with the GetFeatureInfo request, the GetMap is working (the OP clicks on the map),so I can't see how activating the WMS is the issue. The GetFeatureInfo request seems malformed, BBOX should be in the units of the CRS, and appears from the information supplied in the question to be incorrect. That is a better avenue to explore I think. – nmtoken May 6 '20 at 16:52

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.