سؤال

I have the following code:

var layern2 = new OpenLayers.Layer.MapServer("Tech",
                "ServerPathTo_mapserv.exe",
                {
                    map: "ServerPathTo_My.map"
                },
                {
                    isBaseLayer: false,
                    layer: "Layer1",
                    version: "1.1.1",
                    transparent: "true",
                    visibility: true
                });

That does not render a non-transparent layer without images (all titles are rendered with a missing image icon on the upper left corner).

But the following code does render everything in the correct way:

var layern2 = new OpenLayers.Layer.WMS("Tech",
                  "ServerPathTo_mapserv.exe?map=ServerPathTo_My.map&REQUEST=getmap&VERSION=1.1.1&LAYERS=Layer1&FORMAT=PNG", { layers: 'Layer1', TRANSPARENT: 'TRUE' });

Does anyone know what I'm doing wrong?

هل كانت مفيدة؟

المحلول

The 2d argument are options for the MapServer's layer, and the 3rd argument are options for the OpenLayers's layer.

Try:

var layern2 = new OpenLayers.Layer.MapServer("Tech",
                "ServerPathTo_mapserv.exe",
                {
                    map: "ServerPathTo_My.map",
                    layer: "Layer1",
                    version: "1.1.1",
                    transparent: "true"
                },
                {
                    isBaseLayer: false,
                    visibility: true
                });
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top