我正在尝试将静态图像图例放置在地图顶部的OpenLayers地图的右下角.我尝试使用绝对定位的DIV,但它往往被其他物体碰撞(即使是高z-index).
有没有办法使用OpenLayers API执行此操作?我注意到OpenMap有一个Layer.ScreenOverlay方法(http://openspace.ordnancesurvey.co.uk/openspace/example7.html),这正是我所需要的,但OpenLayers中我找不到这样的方法.
我正在重新解析已加载到地图上的KML,类似于此处的示例:http: //openlayers.org/dev/examples/sundials.html并将其转换为可点击列表,将地图置于中心点击,然后显示它的弹出窗口.
这在Google地图中很容易实现,但我找不到任何类似的Openlayers示例.有没有更简单的方法来做到这一点?内置的东西我不见了?
HTML:
<ul id="locationTable">
</ul>
Run Code Online (Sandbox Code Playgroud)
JS:
htmlRows = "";
for(var feat in features) {
// Build details table
featId = features[feat].id; // determine the feature ID
title = jQuery(f).filter('[name=TITLE]').text();
htmlRow = "<li><a href="javascript:selectFeature('"+featId+"');\">"+title+"</a></li>";
htmlRows = htmlRows + htmlRow;
}
jQuery('#locationTable').append(htmlRows);
Run Code Online (Sandbox Code Playgroud)
然后为selectFeature函数:
function selectFeature(fid) {
for(var i = 0; i<kml.features.length;++i) {
if (kml.features[i].id == fid)
{
selected = new OpenLayers.Control.SelectFeature(kml.features[i]);
selected.clickFeature(); // make call to simulate Click event of feature
break;
}
}
}
Run Code Online (Sandbox Code Playgroud) 是否有更多的Pythonic方法来做到这一点?我知道一定有.
for form in forms:
d[form.keys()[0]] = form.values()[0]
Run Code Online (Sandbox Code Playgroud)
谢谢!