2

私はopenLayersが初めてで、GMLオーバーレイを追加しようとしています:

http://the506.com/elxnmaps/2011/ftontest.html

このファイルは、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()
    }   

問題の原因は何ですか?修正できますか?

4

1 に答える 1

0

テストすると、ポーリングごとのレイヤーが 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 でリロードしてみてください。

于 2013-01-07T16:55:14.130 に答える