当前位置: 首页 > 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.jsqmd.com/news/125827/

相关文章:

  • [学习笔记]qwen3大模型微调实战
  • 变容二极管电容调节机制解析:电压控制结电容的实践原理
  • 2024《Three-way clustering: Foundations, survey and challenges》
  • 2024《A Rapid Review of Clustering Algorithms》
  • 并网型直驱永磁同步风力发电系统simulink仿真
  • 8 个降AI率工具,研究生必备!
  • SQL BETWEEN 操作符
  • Trie字典树
  • 从下载到激活:Multisim14.3教学环境安装全记录
  • LangFlow知识图谱构建辅助流程设计
  • 我发现了人人都在吹的 CSS 神技——然后我的写法彻底变了
  • 从单点充电到全域智控:安科瑞重塑新能源充电生态
  • 图解说明Altium Designer高速信号回流路径设计
  • 2025年中国电缆一线品牌推荐:中国电缆知名品牌盘点,缆标杆品牌推荐(12月更新) - 品牌2026
  • 户外LED显示屏安装前期风载与防水考量深度解析
  • rust自动调用Deref(deepseek)
  • 告别传统照明痛点,安科瑞智能系统开启智慧控光新时代
  • 全自研仿真GPU求解器x虚实对标物理测量工厂,打造具身合成数据SuperApp,加速具身仿真生态丨光轮智能@MEET2026
  • SmartLayout智能窗口布局工具:重新定义你的多任务工作空间
  • LangFlow语音助手前后端联动设计方案
  • LangFlow SQL生成助手构建过程全记录
  • 如果早点知道这 7 个 Mac 神器,我的早晨至少能少崩溃一半
  • 中国电缆一线品牌推荐2025年TOP榜单:矿山煤矿、变频、光伏、绝缘、工程项目电缆标杆品牌盘点(12月新版) - 品牌2026
  • 基于Keil的STM32实时变量监控:图解说明方法
  • 串口数据缓存管理策略:qserialport高级应用指南
  • STM32CubeMX无法打开:新手教程之Windows权限设置
  • Altium高速布局技巧:减少串扰的实用方法
  • .NET+AI | Agent | Agent as Function (14)
  • 如何在 Python 中对面板数据进行交叉验证
  • 达梦数据库备份还原