当前位置:网站首页>Mapbox GL development tutorial (11): loading line layers
Mapbox GL development tutorial (11): loading line layers
2022-06-10 17:37: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 , Load line data , Display information such as roads , stay mapbox-gl Corresponding to the line (line) 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 data sources , The first parameter is zero id
map.addSource('route', {
'type': 'geojson',
'data': {
'type': 'Feature',
'properties': {
},
'geometry': {
'type': 'LineString',
'coordinates': [
[122.483696, 37.833818],
[122.483482, 37.833174],
[122.483396, 37.8327],
[122.483568, 37.832056],
[122.48404, 37.831141],
[122.48404, 37.830497],
[122.483482, 37.82992],
[122.483568, 37.829548],
[122.48507, 37.829446],
[122.4861, 37.828802]
]
}
}
});
// Add line layer , data source id Corresponding to the above
map.addLayer({
'id': 'route',
'type': 'line',
'source': 'route',
'layout': {
// Styles at line connections
'line-join': 'round',
// The style at the end of the line
'line-cap': 'round'
},
'paint': {
// Line color
'line-color': '#888',
// The width of the line
'line-width': 8,
// The transparency of the line
'line-opacity':1.0
}
});
Line layer attribute setting link :
https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#line
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/
边栏推荐
- [BSP video tutorial] BSP video tutorial issue 17: single chip microcomputer bootloader topic, startup, jump configuration and various usage of debugging and downloading (2022-06-10)
- Numpy learning notes
- ahk常用函数
- ahk函数命令大全
- Who is using my server? what are you doing? when?
- Gateway服务网关
- 谁在使用我的服务器?在干什么?什么时候?
- SVN中的回退操作
- Facebook AI | learning reverse folding from millions of prediction structures
- 2022年上海市安全员C证操作证考试题库模拟考试平台操作
猜你喜欢

mapbox-gl开发教程(十一):加载线图层

Internet enterprises and chips

Eliminate if Five ways of else

For more than 20 years, there are only Durex, Okamoto and jasbon in the condom market

成立1年便成独角兽,腾讯滴滴做「靠山」,今年新晋的独角兽不简单

企鹅电竞停步,虎牙也难行

善用产业链招商,打造产业集群效应,实现产业协同发展

Brands are difficult to establish, IPO is difficult, and Chinese tea enterprises are trapped in "tradition"?

vscode常用快捷键

Graduation season: to you
随机推荐
新思科技在《 2022 年 Gartner 应用安全测试关键能力报告》中表现优异 在五个常见用例中荣获最高分
Gateway服务网关
Fabric. JS lock the background image, not affected by zooming and dragging
vscode常用快捷键
Nat. Commun. | Knowledge integration and decision support for accelerating the discovery of antibiotic resistance genes
期货账户资金安全吗?
厉害了,工信部推出 “一键解绑” 手机号绑定的互联网账号,堪称神器
二十多年了,安全套市场还只有杜蕾斯、冈本、杰士邦
蓝桥杯_挑选子串_组合数学_乘法原理_ / 尺取法
Facebook AI | 从数百万预测结构中学习逆向折叠
提升园区服务水平,优化营商环境该从哪些方面入手
当v-if和v-for需要同时使用的时候
Importerror: libgl.so.1: cannot open shared object file: no such file or directory
Knowledge-based BERT: 像计算化学家一样提取分子特征的方法
Numpy learning notes
2022G1工业锅炉司炉考题及在线模拟考试
HTML+PHP+Mysql登录注册页面
仅需三步学会使用低代码ThingJS与森数据DIX数据对接
Detailed derivation of perspective projection transformation and related applications
KDD 2021 | MoCL:利用多层次领域知识的分子图对比学习