为什么不;不要在地图上显示特征
why doesn't show feature on map
这是fiddle Link。当它像以下代码一样时,功能不会显示在地图上:
var featureVectorLayer = new ol.layer.Vector({
source: featureClusterSource,
style: new ol.style.Style({
fill: new ol.style.Fill({
color: 'rgba(255, 255, 255, 0.2)'
}),
stroke: new ol.style.Stroke({
color: 'blue',
width: 2
}),
image: new ol.style.Circle({
radius: 7,
fill: new ol.style.Fill({
color: '#ffcc33'
})
})
})
});
但我将源-featureClusterSource更改为featureVectorSource。它运行良好,但在这段时间里,当我点击地图上的功能时,我没有得到功能。
var featureVectorLayer = new ol.layer.Vector({
source: featureVectorSource,
style: new ol.style.Style({
fill: new ol.style.Fill({
color: 'rgba(255, 255, 255, 0.2)'
}),
stroke: new ol.style.Stroke({
color: 'blue',
width: 2
}),
image: new ol.style.Circle({
radius: 7,
fill: new ol.style.Fill({
color: '#ffcc33'
})
})
})
});
如何使用featureClusterSource在地图上显示要素?
但我将源-featureClusterSource更改为featureVectorSource。它运行良好,但在这段时间里,当我点击地图上的功能时,我没有得到功能。
单击相交的要素时,更改"EachFeatureAtPixel"方法以将它们添加到阵列中。这是一把工作小提琴
map.on("singleclick", singleClickCB);
function singleClickCB(event) {
var features = [];
map.forEachFeatureAtPixel(event.pixel, function(feature, layer) {
features.push(feature);
});
if (features) {
var i;
for (i = 0; i < features.length; ++i) {
alert(features[i].get('title'));
}
}
} ;
相关文章:
- 从桌面读取python文件时高亮显示代码
- 使用JS如何动态更改显示的html文件中的文本背景颜色
- 如何在生成下载文件时显示加载动画
- React重新渲染但未显示正确的组件
- nodejs-expressjs上传图像并显示它们
- 使用JSP从服务器检索和显示图像
- 音频控件在mouseover上显示,在mouseout上淡出
- 让文本输入幻灯片显示输入时的新文本输入?然后向后滑动
- 使用电话间隙在Android应用程序中显示SQL Lite的数据
- 显示5秒后隐藏潜水
- 画廊图像未显示
- 不显示带有本地json文件数据的谷歌地图脚本
- 如何将json数据显示为html
- 谷歌地图不是以HTML显示,而是在JS Fiddle上工作
- 在地图框gl中单击高亮显示特征
- 为什么不;不要在地图上显示特征
- 如何在打开的图层中高亮显示选定的特征3
- 如何在传单地图中显示一个弹出窗口,显示Geoserver WMS层的特征属性
- 使用自定义Pinterest "Pin It"显示帖子特征图像的按钮
- 如何在地图框上显示单个特征弹出