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

高德地图_Loca

Loca的引入与容器创建

1. 使用高德地图`jsApiLoader`创建`AMap`实例后, 会自动在`window`对象上挂载`.Loca`属性
AMapLoader.load({key: '',version: "2.0",Loca: {version: '2.0',},plugins: []
}).then(res => {// console.log(window.Loca)
}).catch(err => {})
  1. 创建容器: 需要注意的是, 必须要先创建map实例, 才能挂载Loca容器
mapInstance = new AMap.Map(mapContainerRef.value, {viewMode: "3D",zoom: 10,zooms: [3, 20],center: [], // 中心点mapStyle: '' // 样式
})
locaContainer = new window.Loca.Container({map: mapInstance
})

使用Loca绘制贴地点

[Loca API 2.0](https://lbs.amap.com/demo/loca-v2/demos/cat-scatter/sz-road)

创建基本的贴地点

1. 创建绿色普通点图层
// 1. 创建绿色普通点图层
let normalGreenScatterLayer = null 
normalGreenScatterLayer = new window.Loca.ScatterLayer({zIndex: 111,opacity: 1,visible: true,zooms: [3, 20],loca: locaContainer // 将
})
  1. 为容器设定数据
const geo_green = transGeo(list)
normalGreenScatterLayer.setSource(geo_green)
normalGreenScatterLayer.setStyle({color: "rgba(43,156,75,1)",unit: "px",size: [10, 10],borderWidth: 0
})function transGeo(locationList) {const geo = new window.Loca.GeoJSONSource({data: {type: "FeatureCollection",features: locationList.map((item) => ({type: "Feature",geometry: { type: "Point", coordinates: [item.lon, item.lat] },properties: { ...item }}))}})return geo
}
  1. 绘制
let dat = new window.Loca.Dat()
dat.addLayer(normalGreenScatterLayer, "贴地")

创建呼吸点

1. 创建图层: 和labelLayers不同, 每一种Loca图层都必须重新创建
// 红色呼吸点
breathRedScatterLayer = new window.Loca.ScatterLayer({zIndex: 113,opacity: 1,visible: true,zooms: [3, 20],loca: locaContainer
})
  1. 为图层传入数据: 需要注意为呼吸点设定animate属性
const geo_red = transGeo(list)
breathRedScatterLayer.setSource(geo_red)
breathRedScatterLayer.setStyle({unit: "meter",size: [2600, 2600],borderWidth: 0,texture: "https://a.amap.com/Loca/static/loca-v2/demos/images/breath_red.png",duration: 500,animate: true
})
  1. 绘制数据, 并执行动画
locaContainer.animate.start()
dat.addLayer(breathRedScatterLayer, "红色")
http://www.zskr.cn/news/138265.html

相关文章:

  • 2024《Three-way clustering: Foundations, survey and challenges》
  • 变容二极管电容调节机制解析:电压控制结电容的实践原理
  • [学习笔记]qwen3大模型微调实战
  • 2024《A Rapid Review of Clustering Algorithms》
  • 我发现了人人都在吹的 CSS 神技——然后我的写法彻底变了
  • LangFlow知识图谱构建辅助流程设计
  • rust自动调用Deref(deepseek)
  • 告别传统照明痛点,安科瑞智能系统开启智慧控光新时代
  • LangFlow SQL生成助手构建过程全记录
  • 如果早点知道这 7 个 Mac 神器,我的早晨至少能少崩溃一半
  • 手把手教你使用STM32CubeMX配置硬件I2C外设
  • 达梦数据库备份还原
  • .NET+AI | Agent | Agent as Function (14)
  • LangFlow法律文书辅助撰写系统设计思路
  • 抖音下载工具无水印终极指南:实用技巧与高效方法
  • 如何在 Matplotlib 中创建自定义颜色调色板 – 离散与线性颜色映射,解释说明
  • 8 个降AI率工具,研究生必备!
  • Arduino IDE读取心率传感器数据的核心要点
  • 如何创建样式优美的 Streamlit Dataframes,第二部分:使用 AgGrid
  • 如何创建优雅的 Streamlit 数据框,第一部分:使用 Pandas Styler
  • MDK实现Modbus RTU通信操作指南
  • LangFlow远程医疗问诊前置筛查工具
  • 如何使用卫星图像创建你自己的 CV 数据集:来自太空的野火
  • LangFlow代码生成辅助工具实战搭建
  • 基于NX的智能制造解决方案:深度剖析
  • USB3.0引脚定义与连接器选型配合要点通俗解释
  • macOS窗口管理革命:Topit置顶工具的7种高效工作流配置
  • LangFlow微服务架构改造建议:适应大规模应用场景
  • milvus:存储检索高维向量的AI数据库
  • 基于协程的异步数据流Flow