Internet explorer OpenLayers:在某些浏览器中不渲染矢量层

Internet explorer OpenLayers:在某些浏览器中不渲染矢量层,internet-explorer,firefox,openlayers,gml-geographic-markup-lan,Internet Explorer,Firefox,Openlayers,Gml Geographic Markup Lan,我是openLayers的新手,正在尝试添加GML覆盖: 该文件在Chrome和Safari中呈现得非常完美,但在Firefox或IE中根本不呈现;只有底层的Google层。它与HTML页面位于同一目录中。我尝试的东西似乎都不管用。下面是有问题的代码: function init(){ map = new OpenLayers.Map('map', { projection: 'EPSG:3857', layers: [(Go

我是openLayers的新手,正在尝试添加GML覆盖:

该文件在Chrome和Safari中呈现得非常完美,但在Firefox或IE中根本不呈现;只有底层的Google层。它与HTML页面位于同一目录中。我尝试的东西似乎都不管用。下面是有问题的代码:

    function init(){
          map = new OpenLayers.Map('map', {
          projection: 'EPSG:3857',
          layers: [(Google layers)],
          center: new OpenLayers.LonLat(-66.6, 46.0).transform('EPSG:4326', 'EPSG:3857'),
          zoom: 10
});
    map.addControl(new OpenLayers.Control.LayerSwitcher());

    (styling rules)

var kmllayer = new OpenLayers.Layer.Vector("Poll-by-Poll Data", {
            protocol: new OpenLayers.Protocol.HTTP({
                url: './13003test.gml',
                format: new OpenLayers.Format.GML({extractAttributes: true})
            }),
            strategies: [new OpenLayers.Strategy.Fixed()],
    visibility: true,
    styleMap: new OpenLayers.StyleMap(style),
    projection: new OpenLayers.Projection('EPSG:4326')
        });

    map.addLayer(kmllayer);

        selectControl = new OpenLayers.Control.SelectFeature(kmllayer,
            {onSelect: onFeatureSelect, onUnselect: onFeatureUnselect});

        map.addControl(selectControl);
        selectControl.activate()
    }   

是什么导致了这个问题,它能被修复吗?

当我测试时,看起来你的逐层轮询在Chrome/Firefox中成功加载。但是,stylemap.js的第8行有一个语法错误:

var main = new OpenLayers.Style(
{
    fillOpacity: 0.55,
    strokeWidth: 0.4,
    strokeOpacity: 0.9,
    pointRadius: 2,
    strokeColor: "#aaaaaa", // no comma here
}...

删除逗号并尝试在IE中重新加载。

我试图解决您的问题,但没有找到解决方案,但我发现您的.gml文件可能有问题。请参见此处:您能否生成一个新的或修复此问题并重试?