基于mineMap的地图台风灾害预警轨迹可视化方案

2023-10-27 18:21

本文主要是介绍基于mineMap的地图台风灾害预警轨迹可视化方案,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

1.需求概要
可视化界面显示气象云图及台风中心运动变化,实时数据显示;
2.效果预览
在这里插入图片描述
方案实施
1.>图层构成分析:
可视范围内构成的应该包含基础图层和动态移动图层,运动线路,运动风标,及运动信息框;
2.>结构拆分:
//:基于单图层创建多个根据风力大小为半径的风面圆图层;
数据组装:

      /*** @Description:圆心处理* @Author: ShiWei* @Date: 2020-09-07*/makeWindGeo(fea,i) {const cen = turf.point(fea[i].geometry.coordinates)// 圆形展示return turf.sector(cen, fea[i].properties.r10, 0, 360)},if( winData.length!==0){let dataObj=winData.data;let r7=Math.floor(Math.random() * 200 + 20);let r10= Math.floor(Math.random() * 300 + 50);dataObj.map((item,index) =>{let properties={wl:parseFloat(item.mws),r10:r10,r7:r7,startTime:item.startTime,endTime:item.endTime,centerPres:item.centerPres,mws:item.mws,mwsMax:item.mws};let point=[];//单点信息point.push(parseFloat(item.lon),parseFloat(item.lat))stp.push(this.mapController.makeFeature("Point",point,properties))features.push(this.makeWindGeo(stp,index))})let source = this.mapController.makeFeatureCollection(features)this.mapController.addSource(this.map, "circle-source-1", source)this.drwWinCircle('win-circle','circle-source-1',this.map)
      /*** @Description: 绘制圆形风力面 采用单图层绘制多个同类面* @Author: ShiWei* @Date: 2020-09-07*/drwWinCircle(id,source,map){if (map.getLayer(id)) {map.removeLayer(id)}map.addLayer({"id": id,"type": "fill","source": source,"paint": {"fill-color": "#35e2ce","fill-opacity": 0.2,}});},

2.同操作拆分出风面中心点point,及轨迹线路

      if( winData.length!==0){let dataObj=winData.data;let r7=Math.floor(Math.random() * 200 + 20);let r10= Math.floor(Math.random() * 300 + 50);dataObj.map((item,index) =>{let properties={wl:parseFloat(item.mws),r10:r10,r7:r7,startTime:item.startTime,endTime:item.endTime,centerPres:item.centerPres,mws:item.mws,mwsMax:item.mws};let point=[];//单点信息point.push(parseFloat(item.lon),parseFloat(item.lat))//风力轨迹坐标line.push(point);stp.push(this.mapController.makeFeature("Point",point,properties))infos.push({point:point,properties})//中心点winCenter.push(this.mapController.makeFeature("Point",point,properties))features.push(this.makeWindGeo(stp,index))})features.map((ite,idx)=>{markerList.push(ite.geometry.coordinates[0][0])})let source = this.mapController.makeFeatureCollection(features)let winCenterSource = this.mapController.makeFeatureCollection(winCenter)this.mapController.addSource(this.map, "center-source-1", winCenterSource)this.drwWinCenter('win-center','center-source-1',this.map)let geo = {type: "FeatureCollection",features: [{type: "Feature",geometry: {"type": "LineString", "coordinates": line},properties: {}}]}//运动数装倒序组装this.infoList=infos.reverse();this.mapController.addSource(this.map, "line-source-1", geo);this.drwWinLine('line-win',"line-source-1",this.map)this.addMarker(this.map,line)this.moveList=line.reverse();minemaputil.fitBounds(this.map, source, { padding: 200 });}

3.绘制中心点及轨迹路线

  /*** @Description:风圈中心位置标识* @Author: ShiWei* @Date: 2020-09-08*/drwWinCenter(id,source,map){if (map.getLayer(id)) {map.removeLayer(id)}map.addLayer({"id": id,"type": "circle","source": source,"paint": {"circle-color": {"property": "wl","stops": [[0, "rgba(255,255,255,0.60)"],[1, "rgba(230,230,230,0.60)"],[2, "rgba(204,204,204,0.60)"],[3, "rgba(179,179,179,0.60)"],[4, "rgba(154,154,154,0.60)"],[5, "rgba(62,217,230,0.60)"],[6, "rgba(79,214,203,0.60)"],[7, "rgba(85,207,137,0.60)"],[8, "rgba(109,214,106,0.60)"],[9, "rgba(160,230,69,0.60)"],[10, "rgba(213,230,69,0.60)"],[11, "rgba(255,232,79,0.60)"],[12, "rgba(245,188,56,0.60)"],[13, "rgba(245,144,56,0.60)"],[14, "rgba(235,103,47,0.60)"],[15, "rgba(218,73,43,0.60)"],[16, "rgba(190,46,45,0.60)"],[17, "rgba(129,56,184,0.60)"],[18, "rgba(67,2,116,0.60)"]]},"circle-radius": 10}});},/*** @Description:绘制风力轨迹线路* @Author: ShiWei* @Date: 2020-09-08*/drwWinLine(id,source,map){map.addLayer({"id": id,"type": "line","source": source,"layout": {"line-join": "round","line-cap": "round"},"paint": {"line-color": "#64a7c2","line-width": 2,"line-opacity": 0.6}});},

4.风标

/*** @Description:风圈引导标记* @Author: ShiWei* @Date: 2020-09-08*/addMarker(map,data){if(this.markerLister) {this.markerLister.remove();}let el = document.createElement('div');el.style.zIndex = 120;el.className = 'pin-wheel-marker';let p = document.createElement('div');p.className = 'pin-wheel-inner';el.appendChild(p);this.markerLister= new minemap.Marker(el, {offset: [-17, -17]}).setLngLat(data[data.length-1]).addTo(map);this.addInfoMarker(0)},

5.动态信息窗

 /*** @Description:动态信息窗体* @Author: ShiWei* @Date: 2020-09-08*/addInfoMarker(i){let data=this.infoList;if(this.infoMarker) {this.infoMarker.remove();}let el=document.createElement('div');el.className="info-content";let line=document.createElement('li')line.className='info-line'el.appendChild(line)let infoM=document.createElement('div');infoM.className='info-cls'let info=document.createElement('div');info.className='info-menu'let tt = document.createElement('li');tt.innerHTML='持续时间'+data[i].properties.startTime+'--'+data[i].properties.startTime;info.appendChild(tt);let qy=document.createElement('li');qy.innerHTML='中心气压'+data[i].properties.centerPres+'百帕';info.appendChild(qy);let fsMin =document.createElement('li');fsMin.innerHTML='最小风速'+data[i].properties.mws+'米/秒';info.appendChild(fsMin);infoM.appendChild(info)el.appendChild(infoM)this.infoMarker= new minemap.Marker(el, {offset: [8, -60]}).setLngLat(data[i].point).addTo(this.map);},

实时播放,暂停,重置

/*** @Description:播放风力轨迹* @Author: ShiWei* @Date: 2020-09-08*/winStart(){if(this.moveList.length>0){let count=0;if(this.tep!==""){count=this.tep;}else {count=0;}this.moveTimer=setInterval(()=>{this.markerLister.setLngLat(this.moveList[count])this.addInfoMarker(count)this.tep=count;count++;if(count===this.moveList.length){clearInterval(this.moveTimer);this.moveTimer=null;this.markerLister.setLngLat(this.moveList[0])this.addInfoMarker(0)}},2000)}},/*** @Description:暂停* @Author: ShiWei* @Date: 2020-09-08*/winStop(){if( this.moveTimer){clearInterval(this.moveTimer);this.moveTimer=null;}this.moveTimer=setInterval(()=>{let count=this.tep;this.markerLister.setLngLat(this.moveList[count])this.addInfoMarker(count)this.tep=count;count++;if(count===this.moveList.length){clearInterval(this.moveTimer);this.moveTimer=null;this.markerLister.setLngLat(this.moveList[0])this.addInfoMarker(0)}},2000)},/*** @Description:重置* @Author: ShiWei* @Date: 2020-09-08*/rest(){this.tep="";clearInterval(this.moveTimer);this.moveTimer=null;this.markerLister.setLngLat(this.moveList[0])this.addInfoMarker(0)},

注意:利用turf将坐标转换成多边形;利用reverse()将数据顺序倒序达到预期效果
1 const cen = turf.point(fea[i].geometry.coordinates) // 圆形展示 return turf.sector(cen, fea[i].properties.r10, 0, 360) 2. reverse()

在这里插入图片描述

这篇关于基于mineMap的地图台风灾害预警轨迹可视化方案的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/287522

相关文章

MyBatis Plus实现时间字段自动填充的完整方案

《MyBatisPlus实现时间字段自动填充的完整方案》在日常开发中,我们经常需要记录数据的创建时间和更新时间,传统的做法是在每次插入或更新操作时手动设置这些时间字段,这种方式不仅繁琐,还容易遗漏,... 目录前言解决目标技术栈实现步骤1. 实体类注解配置2. 创建元数据处理器3. 服务层代码优化填充机制详

防止Linux rm命令误操作的多场景防护方案与实践

《防止Linuxrm命令误操作的多场景防护方案与实践》在Linux系统中,rm命令是删除文件和目录的高效工具,但一旦误操作,如执行rm-rf/或rm-rf/*,极易导致系统数据灾难,本文针对不同场景... 目录引言理解 rm 命令及误操作风险rm 命令基础常见误操作案例防护方案使用 rm编程 别名及安全删除

Python实现批量CSV转Excel的高性能处理方案

《Python实现批量CSV转Excel的高性能处理方案》在日常办公中,我们经常需要将CSV格式的数据转换为Excel文件,本文将介绍一个基于Python的高性能解决方案,感兴趣的小伙伴可以跟随小编一... 目录一、场景需求二、技术方案三、核心代码四、批量处理方案五、性能优化六、使用示例完整代码七、小结一、

C#使用Spire.Doc for .NET实现HTML转Word的高效方案

《C#使用Spire.Docfor.NET实现HTML转Word的高效方案》在Web开发中,HTML内容的生成与处理是高频需求,然而,当用户需要将HTML页面或动态生成的HTML字符串转换为Wor... 目录引言一、html转Word的典型场景与挑战二、用 Spire.Doc 实现 HTML 转 Word1

使用Python实现Word文档的自动化对比方案

《使用Python实现Word文档的自动化对比方案》我们经常需要比较两个Word文档的版本差异,无论是合同修订、论文修改还是代码文档更新,人工比对不仅效率低下,还容易遗漏关键改动,下面通过一个实际案例... 目录引言一、使用python-docx库解析文档结构二、使用difflib进行差异比对三、高级对比方

Python多线程应用中的卡死问题优化方案指南

《Python多线程应用中的卡死问题优化方案指南》在利用Python语言开发某查询软件时,遇到了点击搜索按钮后软件卡死的问题,本文将简单分析一下出现的原因以及对应的优化方案,希望对大家有所帮助... 目录问题描述优化方案1. 网络请求优化2. 多线程架构优化3. 全局异常处理4. 配置管理优化优化效果1.

Python利用GeoPandas打造一个交互式中国地图选择器

《Python利用GeoPandas打造一个交互式中国地图选择器》在数据分析和可视化领域,地图是展示地理信息的强大工具,被将使用Python、wxPython和GeoPandas构建的交互式中国地图行... 目录技术栈概览代码结构分析1. __init__ 方法:初始化与状态管理2. init_ui 方法:

Python实现数据可视化图表生成(适合新手入门)

《Python实现数据可视化图表生成(适合新手入门)》在数据科学和数据分析的新时代,高效、直观的数据可视化工具显得尤为重要,下面:本文主要介绍Python实现数据可视化图表生成的相关资料,文中通过... 目录前言为什么需要数据可视化准备工作基本图表绘制折线图柱状图散点图使用Seaborn创建高级图表箱线图热

MySQL容灾备份的实现方案

《MySQL容灾备份的实现方案》进行MySQL的容灾备份是确保数据安全和业务连续性的关键步骤,容灾备份可以分为本地备份和远程备份,主要包括逻辑备份和物理备份两种方式,下面就来具体介绍一下... 目录一、逻辑备份1. 使用mysqldump进行逻辑备份1.1 全库备份1.2 单库备份1.3 单表备份2. 恢复

redis中session会话共享的三种方案

《redis中session会话共享的三种方案》本文探讨了分布式系统中Session共享的三种解决方案,包括粘性会话、Session复制以及基于Redis的集中存储,具有一定的参考价值,感兴趣的可以了... 目录三种解决方案粘性会话(Sticky Sessions)Session复制Redis统一存储Spr