1

我试图为标记创建弹出窗口。但它在地图的其他地方显示,如图所示。在这种情况下有点困惑。请给我解决方案。

在此处输入图像描述

JS我试过的代码

var newlonLat = new OpenLayers.LonLat( Lon1, Lat1 )
    .transform( new OpenLayers.Projection("EPSG:4326"),
        map.getProjectionObject() // to Spherical Mercator Projection
        );
    var zoom=9;
    var newmarkers = new OpenLayers.Layer.Markers( "Markers" );
    map.addLayer(newmarkers);
    newmarkers.addMarker(new OpenLayers.Marker(newlonLat));
    map.setCenter (newlonLat, zoom);


    popup = new OpenLayers.Popup("chicken",
        new OpenLayers.LonLat(Lon1, Lat1),
        new OpenLayers.Size(200,200),
        "example popup",
        true);

    map.addPopup(popup);
4

1 回答 1

1

我认为您对弹出窗口进行了错误的协调。您是否尝试像这样定义弹出窗口?:

popup = new OpenLayers.Popup("chicken", 
newlonLat, 
new OpenLayers.Size(200,200), 
"example popup", 
true);
于 2013-06-27T17:13:04.583 回答