当前位置:网站首页>Mapbox GL development tutorial (13): loading 3D surface layers (white mold)
Mapbox GL development tutorial (13): loading 3D surface layers (white mold)
2022-07-21 19:05:00 【Discussion on Geographic Information Technology】
In the development of map application , Load face data with height information , Show simple buildings ( White mold ) Equal effect , stay mapbox-gl The corresponding is filling extrusion (fill-extrusion) Layers , Next, let's talk about how to mapbox-gl load fill-extrusion Layers .
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 , There must be high characters in the data , And it's numeric
map.addSource('buildingdata', {
'type': 'geojson',
'data':
{
features: [
{
"type": "Feature", "properties": {
"height": 54}, "geometry": {
"type": "Polygon", "coordinates": [ [ [ 116.348081212490996, 39.883840939490099 ], [ 116.34796343001851, 39.883841134653565 ], [ 116.34802774164497, 39.883314167283331 ], [ 116.349162742239557, 39.883394622206509 ], [ 116.349173458383987, 39.883328746904887 ], [ 116.349591060991287, 39.883360995629666 ], [ 116.349526739496355, 39.883945585669011 ], [ 116.348980645360754, 39.883905315828763 ], [ 116.348959214223726, 39.884028833222999 ], [ 116.348070488308053, 39.883972671819372 ], [ 116.348081212490996, 39.883840939490099 ] ] ] } }]}
});
// Add a 3D building layer ,id Corresponding to the above
map.addLayer({
'id': 'room-extrusion',
'type': 'fill-extrusion',
'source': 'buildingdata',
'paint': {
// Set fill color
'fill-extrusion-color': '#fff000',
// Get height from attributes , It's used here height Field
'fill-extrusion-height': ['get', 'height'],
// Transparency settings
'fill-extrusion-opacity': 0.5
}
});
Filling extrusion (fill-extrusion) Layer attribute setting link :
https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#fill-extrusion
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 , official account : Discussion on Geographic Information Technology .
mapbox-gl Official website address :https://docs.mapbox.com/mapbox-gl-js/guides/
边栏推荐
- API Test
- 强制卸载额外域控制器
- NFT:数字所有权的核心
- liunx 批量杀死同名进程
- 论文翻译解读:Anytime Bottom-Up Rule Learning for Knowledge Graph Completion【AnyBURL】
- Security video monitoring platform easycvr database fields cannot be updated, how to optimize?
- Exchange class sorting
- Common business interview questions for data analysis
- 解决跨域问题的8种方案(最新最全)
- Essential tools for streamlit Data Science
猜你喜欢
TCP协议
Part I - Fundamentals of C language_ 10. Document operation
Clickhouse Fundamentals
bryntum gantt 5.0.6
下一代无线局域网--802.11n与传统11ag OFDM设备间的PHY互操作性
w10系统,怎样调整应用的分辨率
V853开发板硬件资料——RISC-V核E907用户手册
Pytorch环境搭建
Nexus 5x swipe the machine and use magisk to obtain root permission
The thought of depth first and breadth first
随机推荐
软件测试面试题:您认为在测试人员同开发人员的沟通过程中,如何提高沟通的效率和改善沟通的效果?维持测试人员同开发团队中其他成员良好的人际关系的关键是什么?
软件测试面试题:你对测试最大的兴趣在哪里?为什么?
Security video monitoring platform easycvr database fields cannot be updated, how to optimize?
C语言运算符
C language type conversion
第一部分—C语言基础篇_7. 指针
奈雪的茶布局元宇宙 传统品牌如何转战元宇宙营销
Excel to JSON (tree structure)
The latest open source! Lidar based location recognition network overlaptransformer, ral/iros 2022
软件测试面试题:引用与指针有什么区别?
Banks are not Tangseng meat banks are solid barriers to financial security.
ESP 特权隔离机制介绍
求解单源最短路径的手工实现
Manual implementation of solving single source shortest path
Don't be silly to distinguish these kinds of storage volumes of kubernetes
Huffman tree and Huffman coding test points
乐鑫ESP-RTC 实时音视频通信方案
C语言进阶——静态通讯录
oracle 启动命令
TCP協議