0

Three of my WMS layers are not displaying on the map.
...
...

  trans = new ol.layer.Tile({
     name: '<b>Transmission Lines</b>',  
     visible : false,
     source: new ol.source.TileWMS({
         url: 'http://*******/cgi-bin/mapserv?map=/data/mapFile/trans.map',     
         params: {
             'LAYERS': 'trans', 
             'TRANSPARENT': true
         }
     })
  });

  energyGroup = new ol.layer.Group({
     layers: [trans, distribute, station],
     name: '<b>Energy</b>'
  });

  view = new ol.View({
     center: ol.proj.fromLonLat([15.4542, -10.7587]),
     zoom: 3, 
     maxZoom: 14, 
     minZoom: 3
  });

  olMap = new ol.Map({
        layers: [******, energyGroup, ******],
        view: view
  });

Here is my mapfile:
...

EXTENT 14.512797 -34.507545 35.797839 -23.569398
FONTSET 'fonts.txt'
SYMBOLSET 'symbols.txt'
PROJECTION
        'proj=longlat'
        'ellps=WGS84'
        'datum=WGS84'
        'no_defs'
END

IMAGECOLOR 255 255 255
IMAGEQUALITY 95
IMAGETYPE png

OUTPUTFORMAT
        NAME png
        DRIVER 'GD/PNG'
        MIMETYPE 'image/png'
        IMAGEMODE RGBA
        EXTENSION 'png'
END
# Legend
LEGEND
    #IMAGECOLOR 255 255 255
    STATUS ON
        KEYSIZE 18 12
        LABEL
            TYPE BITMAP
            SIZE MEDIUM
            COLOR 0 0 89
        END
END

WEB
    TEMPLATE '/data/mapFile/template.html'
    IMAGEPATH '/data/mapFile/output/'
    IMAGEURL 'data/mapFile/output/'

    METADATA
        'wms_title'             'Transmission Lines'
        'wms_onlineresource'    'http://*****/cgi-bin/mapserv?map=/data/mapFile/trans.map&'
        'wms_enable_request'    '*'
        "wms_feature_info_mime_type" "text/html"
        'wms_srs'               'EPSG:4326'
        "wms_server_version"    "1.1.0"
    END
END

LAYER
    NAME 'trans'
    TYPE LINE
    DATA '/******/transmission.shp'
    STATUS ON
    DUMP TRUE
    METADATA
        "gml_include_items"     "all"
        "wms_include_items"     "all"
        "wms_feature_info_mime_type" "text/html"
        "wms_enable_request"    "*"
    END
    TRANSPARENCY 100
    PROJECTION
        'proj=longlat'
        'ellps=WGS84'
        'datum=WGS84'
        'no_defs'
    END
    CLASS
            NAME    'Transmission Lines' 
            STYLE
                WIDTH   0.90
                OUTLINECOLOR 203 69 51
            END
    END
END

What am I missing here?

  • any error in console? – Ömür Bilgili Feb 26 '18 at 15:14
  • What GetMap requests are generated by OL? Do the requests work in a browser? – nmtoken Feb 27 '18 at 2:29
  • visible : false are you using a layer switcher to change the visibility? – pavankguduru Feb 27 '18 at 6:31
  • No errors in the console, no request is generated and the layer is visible on click, I am using GeoExt – Asanda Mar 12 '18 at 7:20
  • What version of OpenLayers are you using, and which WMS version does it default to? and related, why are you defaulting to WMS version 1.1.0, and not 1.3.0 or 1.1.1? Again can you post the GetMap requests that are being generated – nmtoken Mar 26 '18 at 19:16

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.