OpenLayers getFeatureInfo弹出窗口生成this.size为null

时间:2011-11-30 01:43:46

标签: javascript openlayers

我正在尝试使用弹出功能信息创建OpenLayers。我从OpenLayers示例中获取了代码,并且只修改了url到我的本地geoserver。地图正在显示,当我点击某个功能时,请求被发送但响应为空,并且firebug显示错误“this.size为null”。当我运行请求url时,会生成单独的功能信息。 这是代码:

var map, info;

function load() {
    map = new OpenLayers.Map({
        div: "map",
        maxExtent: new OpenLayers.Bounds(20.163,53.228,20.208,53.257)
        //maxExtent: new OpenLayers.Bounds(143.834,-43.648,148.479,-39.573)
        //maxExtent: new OpenLayers.Bounds(19,90,19,90)
    });

    var punkty_zdjecia = new OpenLayers.Layer.WMS("Punkty Zdjecia",
        "http://localhost:6060/geoserver/wms", 
        {'layers': 'cite:ulice2', transparent: false, format: 'image/gif'},
        {isBaseLayer: true}
    );

    map.addLayers([punkty_zdjecia]); 

    info = new OpenLayers.Control.WMSGetFeatureInfo({
        url: 'http://localhost:6060/geoserver/wms', 
        title: 'Test url',
        queryVisible: true,
        eventListeners: {
            getfeatureinfo: function(event) {
                map.addPopup(new OpenLayers.Popup.FramedCloud(
                    "chicken", 
                    map.getLonLatFromPixel(event.xy),
                    new OpenLayers.Size(200,200),
                    event.text,
                    null,
                    true
                ));
            }
        }
    });
    map.addControl(info);
    info.activate();

    map.addControl(new OpenLayers.Control.LayerSwitcher());
    map.zoomToMaxExtent();
}

  

我正在使用OpenLayers 2.11和Firefox浏览器

0 个答案:

没有答案