6

I took a look at Getting MapServer to show raster?, and although helpful, it did not solve my issue.

After spending the last couple days on this, I am confused as to why I'm getting:

msWMSGetCapabilities(): WMS server error. WMS request not enabled. Check wms/ows_enable_request settings

I've tried

"wms_enable_request" "*"

along with

"ows_enable_request" "*"

both in METADATA under WEB and METADATA under LAYER

As for my URL, I am using:

http://192.168.2.164/cgi-bin/mapserv.exe?map=/data2/html/OL_AllWorldAirports/catest.map&SERVICE=WMS&REQUEST=GetCapabilities

I initially had the VERSION set too (to 1.1.1) but I read somewhere this is not a necessity.

/tmp/mapserver3.log is not providing much help.

In regards to how the mapfile(s) and data are set up:

-I have one mapfile which has one layer. Within that layer, I reference another mapfile. The mapfile (catest.map) being referenced uses an OGR connection and connects to a .db file.

See here for the mapfiles: https://gist.github.com/DavidPardy/5911943

I feel that I'm close and have some glaring error somewhere, but not sure where to pinpoint it.

  • have you tried another kind of connection? Postgis perhaps? – Gery Jul 2 '13 at 19:48
  • Hi @Gery, no I have not. If possible I'd like to try and get this working with what I have. – Nubtacular Jul 2 '13 at 20:50
  • Hi David, I use mapserver but never tried db formats, so not sure if that's the problem, that's why if you try other connections you can know if your mapfile works well or not, and see if the db file is the problem. – Gery Jul 2 '13 at 21:01
  • Understood @Gery, appreciate the quick reply. I have had lots of success using db files in the past. The long term goal for this is to use OpenLayers getFeatureInfo to get data from the db on onclicks and hover with the mouse. I should add that I tried catest.map through a php file and the data is displaying correctly. – Nubtacular Jul 2 '13 at 21:03
  • msWMSGetCapabilities() is not supported by version 1.1.1, try version 1.1.0 – Asanda Mar 24 '17 at 5:39
3

Looks like the mapfile you are specifying in the URL, catest.map, does not have the ows_request_enabled inside the WEB - METADATA section. So WMS is not enabled for that mapfile.

You have the metadata entries in your main_mapfile.map. You need these in your catest.map mapfile.

  • Thank you @MICHAEL SMITH, I will look into this when I get home. – Nubtacular Jul 2 '13 at 23:21
3

Seems like I was making the issue much more complicated than it needed to be.

In my mapfile, I now have:

WEB
  METADATA
    "wms_title" "Customer Airports"
    "wms_onlineresource" "http://192.168.2.164/cgi-bin/mapserv.exe?"
    "wms_enable_request" "*"
    "wms_srs" "EPSG:4326"
    "wms_feature_info_mime_type" "text/html"
    "wms_format" "image/png"
  END
END

For the layer within the same mapfile:

LAYER
  NAME CustomerAirports
  DEBUG 5
  TYPE ANNOTATION
  CONNECTIONTYPE OGR
  CONNECTION 'CustomerAirports.db'
  DATA 'Airports'
  STATUS ON
  TEMPLATE "d_template.html"
  DUMP TRUE
  TOLERANCE 3
  METADATA
    "wms_title" "IATA"
    "wms_srs" "EPSG:4326"
    "wms_server_version" "1.1.1"
  END
  LABELITEM "ICAO"
  CLASS
    STYLE
      SYMBOL 'Airport'
      COLOR 0 0 0
      SIZE 6
    END
    STYLE
      SYMBOL 'Airport'
      COLOR  0 0 255
      SIZE 4
    END
    LABEL
      FONT "andalewt"
      TYPE truetype
      ENCODING "UTF-8"
      SIZE 9
      POSITION AUTO
      PARTIALS FALSE
      COLOR 8 29 118
      OFFSET 1 1
      PRIORITY 10
      BUFFER 0
      FORCE OFF
    END # LABEL
   END

   PROJECTION
     "init=epsg:4326"
     "proj=latlong"
     "ellps=WGS84"
     "datum=WGS84"
   END
 END

Outside the layer I also set the projection.

As for the html/php file:

var cust = new OpenLayers.Layer.WMS("CustomerAirports",
"http://192.168.2.164/cgi-bin/mapserv.exe?map=/data2/html/OL_AllWorldAirports/ca.map",
{layers: ['CustomerAirports']}, {wrapDateLine: true});

As for the toggle/js, I just took that from the OL example online.

3

place this in your map file under MAP > WEB:

METADATA 
    WMS_ENABLE_REQUEST "*" 
END
0

First change wms_server_version to 1.1.0 then

     METADATA   
        "wms_title"      "" ## REQUIRED
        "wms_onlineresource" ""## Recommended
        "wms_srs"            ""
        "wms_enable_request" "*"    
        "wfs_feature_info_mime_type" "application/vnd.ogc.gml"

        "wfs_title"          "" ## REQUIRED
        "wfs_onlineresource" "" ## Recommended
        "wfs_srs"            ""
        "wfs_abstract"       "" 
        "wfs_enable_request" "*" 
    END

Then on your code

    info = new OpenLayers.Control.WMSGetFeatureInfo({
        url: 'yourURL', 
        drillDown: true,
        queryVisible: true,
        infoFormat: 'application/vnd.ogc.gml',
        eventListeners: {
            getfeatureinfo: function(event) {
                map.addPopup(new OpenLayers.Popup.FramedCloud(
                    "chicken", 
                    map.getLonLatFromPixel(event.xy),
                    null,
                    event.text,
                    null,
                    true
                ));
            }
        }
    });
    map.addControl(info);
    info.activate();

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.