//cyd var cydclusterSource = new ol.source.Cluster({ distance: 40,source: new ol.source.Vector({ features:(new ol.format.GeoJSON()).readFeatures(JSON.stringify(cyd)) }) }); //sc var scclusterSource = new ol.source.Cluster({ distance: 40,source: new ol.source.Vector({ features:(new ol.format.GeoJSON()).readFeatures(JSON.stringify(sc)) }) }); //sy var syclusterSource = new ol.source.Cluster({ distance: 40,source: new ol.source.Vector({ features:(new ol.format.GeoJSON()).readFeatures(JSON.stringify(sy)) }) }); //xq var xqclusterSource = new ol.source.Cluster({ distance: 40,source: new ol.source.Vector({ features:(new ol.format.GeoJSON()).readFeatures(JSON.stringify(xq)) }) }); var cydstyleCache = {}; this.cydVectorLayer = new ol.layer.Vector({ source:cydclusterSource,style:function(feature) { var size = feature.get(‘features‘).length; var style = cydstyleCache[size]; if (!style) { style = new ol.style.Style({ image: new ol.style.Circle({ radius: 20,stroke: new ol.style.stroke({ color: ‘#fff‘ }),fill: new ol.style.Fill({ color: ‘#3399CC‘ }) }),text: new ol.style.Text({ text: "cyd "+size.toString(),fill: new ol.style.Fill({ color: ‘#fff‘ }) }) }); cydstyleCache[size] = style; } return style; } });https://blog.csdn.net/zy13608089849/article/details/70809354
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。