1

Tested the MapServer WMS Server with GetMap and GetCapabilities, but OpenLayers shows up blank. Using QGIS as WMS client also fails saying error downloading. The OSM layer in the OpenLayers works fine when the map projection is set to EPSG:3857, and doesn't work when EPSG:4326 is used. The local WMS service doesn't get displayed in either case. The OpenLayers template works fine. (But that's not even a WMS Service that's just the browse mode)

WMS Mapfile:

    MAP
    NAME "distt"
    IMAGETYPE PNG
    EXTENT 68 6 98 38
    SHAPEPATH "/ms4w/Apache/htdocs/data/"
    SIZE 600 600
    IMAGECOLOR 255 255 255
    PROJECTION
         "init=epsg:4326"
    END  
    WEB
      IMAGEPATH "D:/ms4w/Apache/htdocs/data"  
      IMAGEURL "D:/ms4w/Apache/htdocs/data"
      METADATA
        "wms_title"           "distt"
        "wms_onlineresource"  "http://127.0.0.1/ms4w/apache/cgi-in/mapserv.exe?map=D:\ms4w\apache\htdocs\data\MAP1.map"
        "wms_srs"             "EPSG:4326"
        "wms_format" "image/png"
        "wms_enable_request" "*"
        "ows_enable_request" "*"
      END
    END

    LAYER
      NAME "distt"
      TYPE POLYGON
      STATUS ON
      DATA India_districts_shp
      METADATA
      "wms_title" "distt"
      "wms_srs" "EPSG:4326"
      "wms_server_version" "1.1.1"
      "wms_enable_request" "*"
      "ows_enable_request" "*"
    END
    PROJECTION
         "init=epsg:4326"
    END  
      CLASS
      NAME "Countries"    
      STYLE
        COLOR 200 0 200
        OUTLINECOLOR 0 0 0 
        END #STYLE
      END # CLASS
    END #LAYER

  END # MAP

HTML Openlayers:

    <!doctype html>
    <html lang="en">
      <head>
        <link rel="stylesheet" href="https://openlayers.org/en/v4.1.1/css/ol.css" type="text/css">
        <style>
          #map {
            height: 512px;
            width: 1024px;
          }
          .ol-attribution a { color: black; }
        </style>
        <title>MNCFC CROP Map</title>
        <script src="https://openlayers.org/en/v4.1.1\build\ol.js" type="text/javascript"></script>
      </head>
      <body>
        <h1>Map</h1>
        <div id="map" class="map"></div>  

          <script type="text/javascript">



           var layers = [
         new ol.layer.Tile({
              source: new ol.source.OSM()
            }),

          new ol.layer.Image({
              extent:[68,6,98,38],
              source:new ol.source.ImageWMS({
                url:'http://127.0.0.1/cgi-bin/mapserv.exe?map=D:\\ms4w\\apache\\htdocs\\data\\MAP1.map',
                params:{'LAYERS': 'distt'},
                ratio: 10,
                serverType: 'mapserver'
              }),
            })
          ];
          var map = new ol.Map({
            layers: layers, 
            target: 'map',
            view: new ol.View({
             projection: 'EPSG:4326',
              //center: ol.proj.fromLonLat([83, 22]),
              center: ol.proj.transform([83, 22], 'EPSG:4326', 'EPSG:3857'),
              zoom: 4.5
            })
          });
          map.addLayer(layers);
        </script>
      </body>
    </html>

closed as off-topic by nmtoken, whyzar, Vince, Andre Silva, user30184 Sep 6 '18 at 19:24

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This problem cannot or can no longer be reproduced. Changes to the system or to the asker's circumstances may have rendered the question obsolete, or the question does not include a procedure to enable potential answerers to reproduce the same symptoms. Such questions are off-topic as they are unlikely to help future readers, but editing them to include more details can lead to re-opening." – nmtoken, whyzar, Vince, Andre Silva, user30184
If this question can be reworded to fit the rules in the help center, please edit the question.

  • have you checked the log files ? – Shiko Jul 18 '17 at 8:41
  • msWMSLoadGetMapParams(): WMS server error. At least one layer name required in LAYERS. @Shiko – user97658 Jul 18 '17 at 8:45
  • Try this link gis.stackexchange.com/questions/86964/… – Shiko Jul 18 '17 at 8:46
  • @Shiko Ive cross checked as much as I could from the mentioned url and more, but most use openlayers 2 syntax. Ive added brackets, and corrected a spelling error, but I dont see anything else. – user97658 Jul 18 '17 at 9:01
  • Why STATUS is OFF? – juminet Jul 18 '17 at 19:30