当前位置:网站首页>Mapbox GL development tutorial (12): loading surface layer data
Mapbox GL development tutorial (12): loading surface layer data
2022-06-29 20:17:00 【On Geographic Information Technology】
–mapbox-gl It's open source 、 be based on webgl Front end map class library of Technology –
In the development of map application , Loading face data , Display area 、 Scope and other information , stay mapbox-gl Corresponding to face (fill) Layers , Next, let's talk about how to mapbox-gl Load line layer data .
mapbox-gl Load vector data , Through two data sources , One is vector slicing (vector), The other is geojson data , After the data source is loaded , Then set the layer .
With geojson Take the data :
// add to geojson data source ,id by maine
map.addSource('maine', {
'type': 'geojson',
'data': {
'type': 'Feature',
'geometry': {
'type': 'Polygon',
'coordinates': [
[
[137.13734, 45.13745],
[136.96466, 44.8097],
[138.03252, 44.3252],
[139.06, 43.98],
[130.11617, 43.68405],
[130.64573, 43.09008],
[130.75102, 43.08003],
[130.79761, 43.21973],
[130.98176, 43.36789],
[130.94416, 43.46633],
[131.08482, 45.30524],
[130.66002, 45.46022],
[130.30495, 45.91479],
[130.00014, 46.69317],
[139.23708, 47.44777],
[138.90478, 47.18479],
[138.2343, 47.35462],
[137.79035, 47.06624],
[137.79141, 45.70258],
[137.13734, 45.13745]
]
]
}
}
});
// Add face layer , Use maine Data source
map.addLayer({
'id': 'maine',
'type': 'fill',
'source': 'maine',
'layout': {
},
'paint': {
// Fill color
'fill-color': '#0080ff',
// Transparency settings
'fill-opacity': 0.5
}
});
Face layer color settings , The corresponding parameters can use rgba form :
“fill-color”: “rgba(32, 62, 122, 1)”
Last parameter 1 Also set the transparency , Priority is higher than fill-opacity low .
Face layer attribute setting link :
https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#fill
mapbox-gl Development is a tutorial about how to develop maps from foundation to practical application , Update continuously from time to time , If you have any questions , Leave a message on official account for discussion .
mapbox-gl Official website address :https://docs.mapbox.com/mapbox-gl-js/guides/

边栏推荐
- 【编译原理】语义分析
- Flume配置3——拦截器过滤
- 偶然发现了另一种跨域方式,不知道有没有人这么玩过
- Introduction to the latest version 24.1.0.360 update of CorelDRAW
- Ovirt database modify delete node
- CorelDRAW最新24.1.0.360版本更新介绍讲解
- Lock4j -- distributed lock Middleware -- customize the logic of lock acquisition failure
- Cmake development - Multi Directory Project
- Sword finger offer 66 Building a product array
- File contains vulnerability
猜你喜欢

Koa 源码剖析

There are more than 20 databases in a MySQL with 3306 ports. How can I backup more than 20 databases with one click and do system backup to prevent data from being deleted by mistake?

【摸鱼神器】UI库秒变低代码工具——表单篇(一)设计

Configuration du Flume 4 - source personnalisée + sink

苹果iPhone手机升级系统内存空间变小不够如何解决?

Linux Installation mysql8

Etcd database source code analysis - put process of server

18. `bs对象.节点名.next_sibling` previous_sibling 获取兄弟节点

Flume configuration 1 - basic case

Tag based augmented reality using OpenCV
随机推荐
0/1分数规划专题
Flume-ng配置
Sword finger offer 59 - I. maximum value of sliding window
社区访谈丨一个IT新人眼中的JumpServer开源堡垒机
Summary of swift optional values
JMeter BeanShell explanation and thread calling
Three.js开发:粗线的画法
[fishing artifact] code tool for lowering the seconds of UI Library -- form part (I) design
剑指 Offer 59 - I. 滑动窗口的最大值
命令执行(RCE)漏洞
Go: how to write a correct UDP server
从众伤害的是自己
Measures to support the development of advanced manufacturing industry in Futian District of Shenzhen in 2022
NLP - giza++ implements word alignment
偶然发现了另一种跨域方式,不知道有没有人这么玩过
Understanding of software test logic coverage
Lock4j -- distributed lock Middleware -- customize the logic of lock acquisition failure
Freemaker template framework generates images
4-1 port scanning technology
[sword finger offer] 51 Reverse pair in array