当前位置:网站首页>Openlayers 5.0 discrete aggregation points
Openlayers 5.0 discrete aggregation points
2022-04-23 19:09:00 【GIS roast lamb leg is delicious】
import {OSM, Vector as VectorSource} from 'ol/source.js';
import {Fill, RegularShape, Stroke, Style} from 'ol/style.js';
import Icon from 'ol/style/Icon.js'
import Vectorlayer from 'ol/layer/Vector.js'
import Feature from 'ol/Feature.js'
import Vector from "ol/source/Vector";
import Cluster from "ol/source/Cluster";
import Circle from "ol/style/Circle";
import Text from "ol/style/Text";
/* Discrete aggregation point 1*/
static createLayer(){
webgissource.clusterpointdate = new Vector();
webgissource.clusterSource = new Cluster({
distance:40,
source: webgissource.clusterpointdate
});
var styleCache = {};
webgissource.clusterVectorLayer = new Vectorlayer({
source: webgissource.clusterSource,
zIndex:999,
style: function (feature, resolution) {
// The feature size of the current aggregate dimension data source
var size = parseInt(feature.get('features').length);
// Definition of style
var style = styleCache[size];
// Create if the current style does not exist
// if(0<size && size<=5){
// var src="static/img/ld1.png"
// }else if(5<size && size<=10){
// var src="static/img/ld2.png"
// }else if(10<size && size<=15){
// var src="static/img/ld3.png"
// }else if(15<size && size<=20){
// var src="static/img/ld4.png"
// }else if(20<size ){
// var src="static/img/ld5.png"
// }
if(map.getView().getZoom()==17){
style = [
// Initialize style
new Style({
// Point style
fill: new Fill({
color: 'rgba(0,225,255,0.1)'
}),
stroke: new Stroke({
color: '#00e1ff',
width: 3
}),
image: new Circle({
radius: 6,
fill: new Fill({
color: '#4271ff'
})
}),
// image: new Circle({
// radius: 8,
// fill: new Fill({
// color: 'rgb(0,155,29)'
// })
// })
})
];
styleCache[size] = style;
}else{
//if (!style) {
style = [
// Initialize style
new Style({
// Point style
fill: new Fill({
color: 'rgba(0,225,255,0.1)'
}),
stroke: new Stroke({
color: '#00e1ff',
width: 3
}),
image: new Circle({
radius: size==1?6:14,
fill: new Fill({
color: '#4863ff'
})
}),
// Text style
text: new Text({
// Text content
text: size==1?"":size.toString(),
// fill
font: '14px',
fill: new Fill({
color: 'rgb(255,255,255)'
}),
offsetY: 0,
})
})
];
styleCache[size] = style;
//}
}
return style;
}
});
map.addLayer(webgissource.clusterVectorLayer)
}
static clusterVectorLayer(data){
var points=new Point([x,y]);
var iconFeature = new Feature({
geometry:points,
attributions:data
})
webgissource.clusterpointdate.addFeature(iconFeature)
}
版权声明
本文为[GIS roast lamb leg is delicious]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231908120712.html
边栏推荐
- openlayers 5.0 当地图容器大小改变时,重新加载地图
- Use of kotlin collaboration in the project
- Redis optimization series (III) solve common problems after master-slave configuration
- Raspberry pie uses root operation, and the graphical interface uses its own file manager
- SSDB foundation 2
- Esp01s with Arduino development environment
- 2022.04.23 (the best time for lc_714_to buy and sell stocks, including handling charges)
- The fifth bullet of MySQL learning -- detailed explanation of transaction and its operation characteristics
- 剑指 Offer II 116. 省份数量-空间复杂度O(n),时间复杂度O(n)
- Using Visual Studio code to develop Arduino
猜你喜欢
Wechat applet part of the mobile phone Preview PDF did not respond
mysql_linux版本的下载及安装详解
Introduction to ROS learning notes (I)
Redis optimization series (III) solve common problems after master-slave configuration
Oracle配置st_geometry
Sword finger offer II 116 Number of provinces - spatial complexity O (n), time complexity O (n)
[record] typeerror: this getOptions is not a function
MySQL restores or rolls back data through binlog
Using Visual Studio code to develop Arduino
FTP、ssh远程访问及控制
随机推荐
Oracle configuration st_ geometry
Go language GUI framework Fyne Chinese garbled or not displayed
js上传文件时控制文件类型和大小
8266 obtain 18b20 temperature
Nacos as service registry
RPM包管理
One of the reasons why the WebView web page cannot be opened (and some WebView problem records encountered by myself)
static类变量快速入门
ArcMap连接 arcgis server
The type initializer for ‘Gdip‘ threw an exception
mysql_ Download and installation of Linux version
Tencent cloud GPU best practices - remote development training using jupyter pycharm
Simplified path (force buckle 71)
MySQL restores or rolls back data through binlog
Minesweeping II of souI instance
在渤海期货办理开户安全吗。
Circuit on-line simulation
js获取本机ip地址
[record] typeerror: this getOptions is not a function
腾讯云GPU最佳实践-使用jupyter pycharm远程开发训练