当前位置: 首页 > news >正文

有哪些做网站的莱芜在线和莱芜都市网

有哪些做网站的,莱芜在线和莱芜都市网,公司做网站的费用计什么科目,arvixe如何做网站文章目录 概要效果预览技术思路技术细节小结 概要 本篇文章还是关于最近做到的 mapboxgl 地图展开的。 借鉴官方示例:https://iclient.supermap.io/examples/mapboxgl/editor.html#heatMapLayer 效果预览 技术思路 将接口数据渲染到地图中形成热力图。还需要将热…

文章目录

    • 概要
    • 效果预览
    • 技术思路
    • 技术细节
    • 小结

概要

本篇文章还是关于最近做到的 mapboxgl 地图展开的。
借鉴官方示例:https://iclient.supermap.io/examples/mapboxgl/editor.html#heatMapLayer

效果预览

请添加图片描述

技术思路

  1. 将接口数据渲染到地图中形成热力图。
  2. 还需要将热力图中渲染的点做鼠标移上显示详情 popup 的效果。

注意:因为热力图本身不可以添加鼠标以上效果,所以还是使用了点,将鼠标以上效果加给点,然后把点的透明度设置为0,大小和热力图中点相同,即可完成上图中效果。

技术细节

  1. 地图的加载不再赘述,之前文章中写到了。
  2. 所需要规范的点数据
    其中point是自定义的,传啥都可以, createPopupStyle 就是生成 popup 的 html
featuresList.push({'type': 'Feature','properties': {...point,'description': that.createPopupStyle(point)},'geometry': {'type': 'Point','coordinates': [Number(point.lng), Number(point.lat)]}})
  1. 新建热力图
/*** 添加热力图*/
createHeatPoints(featuresList) {const that = thisconst map = this.map      let heatMapLayer = new mapboxgl.supermap.HeatMapLayer("heatMap",{"map": map,"id": "heatmap","radius": 50,// 设置图层透明度:(参数方式)"opacity": 0.6,// featureWeight指定以哪个属性值为热力权重值创建热力图:"featureWeight": "value",});let heatPoints = {"type": "FeatureCollection","features": featuresList};heatMapLayer.addFeatures(heatPoints);//        设置图层透明度:(函数方式)//        heatMapLayer.setOpacity(0.5);map.addLayer(heatMapLayer);      
},
  1. 添加透明度为0的点以及鼠标移上效果
/*** 添加坐标点及鼠标移上效果*/
addPoints(featuresList) {      const map = this.mapmap.addSource('places', {'type': 'geojson','data': {'type': 'FeatureCollection','features': featuresList}})// 加载 circle 定位圆let img = {name: 'circle_img',sdf: true}this.addCircleImage(img)map.addLayer({'id': 'places','type': 'symbol','source': 'places','layout': {'icon-image': img.name, // 图标ID'icon-size': 0.4, // 图标的大小// 'icon-size': ['get', 'imgSize'], // 图标的大小'icon-anchor': 'center', // 图标的位置// 'text-field': ['get', 'num'],},'paint': {'text-color': '#333','icon-color': 'rgba(0,0,0,0)'},});// Create a popup, but don't add it to the map yet.const popup = new mapboxgl.Popup({closeButton: false,closeOnClick: false});map.on('mouseenter', 'places', (e) => {// Change the cursor style as a UI indicator.map.getCanvas().style.cursor = 'pointer';// Copy coordinates array.const coordinates = e.features[0].geometry.coordinates.slice();const description = e.features[0].properties.description;// Ensure that if the map is zoomed out such that multiple// copies of the feature are visible, the popup appears// over the copy being pointed to.while (Math.abs(e.lngLat.lng - coordinates[0]) > 180) {coordinates[0] += e.lngLat.lng > coordinates[0] ? 360 : -360;}// Populate the popup and set its coordinates// based on the feature found.popup.setLngLat(coordinates).setHTML(description).addTo(map);});map.on('mouseleave', 'places', () => {map.getCanvas().style.cursor = '';popup.remove();});
},
  1. 引入图片使用方法
    注意:vue中引入图片要使用require引入,路径不能以传参的形式传入,最好写相对路径。不然都会报错。
/**
* 引入图片* img obj : name, sdf*/
addCircleImage(img) {const map = this.mapmap.loadImage(require('./circle.png'), (error, image) => {if (error) throw error;if (!map.hasImage(img.name)) map.addImage(img.name, image, {sdf: img.sdf || false});})
}

小结

本方法主要还是使用点和热力图重叠同时显示效果。

http://www.yayakq.cn/news/715735/

相关文章:

  • 哪个建站软件比较好带论坛腾讯企点怎么删除好友
  • 为什么网站很少做全屏网站建设价位
  • 网站建设需要哪些步骤响应式网站开发的理解
  • 济南便宜网站设计制作二维码的平台
  • 定陶区城乡和住房建设局网站网络代码
  • 徐州城乡建设局网站怎么在百度上发布自己的信息
  • 如何进网站如何开发微信小程序商店
  • 网站开发的现状后台网站模板下载
  • 论述网站开发建设的一般流程免费推广网站教程
  • 网站内侧网编大连开发区网站开发公司电话
  • 长沙网站优化诊断做视电影网站赚钱吗
  • 长春网站建设长春怎么自己创建一个免费网站
  • 怎么做网站挣钱wordpress 连接微信
  • 做建材哪个网站平台好网站设计所用的软件
  • 怎么做好网站wordpress美化
  • 大麦网的网站建设免费360地图手机版
  • 网站域名查询系统做网站公司哪家
  • 天猫入驻网站建设重庆专业企业建设网站
  • 做细胞激活的母液网站网站怎么做rss
  • 男女做爰高清免费视频网站杭州网站开发响应式
  • 中国排名高的购物网站c2c网站架构
  • 网站升级建设方案怎么编辑网站源代码
  • wordpress 批量建站注册域名 不建网站
  • 哪些网站做推广比较有效果上海公司购买新能源车条件
  • 张家界网站建设app旅游 网站开发的项目描述
  • 如何做织梦论坛类的网站网站建设 中企动力阀门
  • 网站建设佰首选金手指二七天津seo网站管理
  • 两学一做专题网站用途php网站开发费用
  • 建设一个网站需要哪些方面的开支网站制作培训速成班
  • 网站建设与维护设计大作业jsp简述网站开发流程图