当前位置:网站首页>高德地图Loca 数据可视化 API 2.0的用法
高德地图Loca 数据可视化 API 2.0的用法
2022-06-21 05:46:00 【凡夫俗子001】
1.安装
npm i @amap/amap-jsapi-loader --save
2.使用
<template>
<div id="Sharingrouter">
<div id="container" ref="container"></div>
</div>
</template>
<script>
import AMapLoader from "@amap/amap-jsapi-loader";
var map;
export default {
data() {
return {
aMap: null,
};
},
mounted() {
this.init();
},
methods: {
init() {
AMapLoader.load({
key: "", // 申请好的Web端开发者Key,首次调用 load 时必填
version: "2.0", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
plugins: [],
Loca: {
// 是否加载 Loca, 缺省不加载
version: "2.0.0", // Loca 版本,缺省 1.3.2
},
})
.then((AMap) => {
this.aMap = new AMap.Map("container", {
// resizeEnable: true,
// zoom: 12, //地图显示的缩放级别
zoom: 5.29,
// showLabel: false,
viewMode: '3D',
pitch: 48,
center: [104.780269, 34.955403],
mapStyle: 'amap://styles/45311ae996a8bea0da10ad5151f72979',
});
var loca = new Loca.Container({
map: this.aMap,
});
// 呼吸点
var scatter = new Loca.ScatterLayer({
loca,
zIndex: 10,
opacity: 0.6,
visible: true,
zooms: [5, 10],
});
var pointGeo = new Loca.GeoJSONSource({
url: "https://a.amap.com/Loca/static/loca-v2/demos/mock_data/pulselink-china-city-point.json",
});
scatter.setSource(pointGeo);
scatter.setStyle({
unit: "meter",
size: [100000, 100000],
borderWidth: 0,
texture:
"https://a.amap.com/Loca/static/loca-v2/demos/images/breath_red.png",
duration: 2000,
animate: true,
});
loca.add(scatter);
// ------------------
// 弧线
var pulseLink = new Loca.PulseLinkLayer({
// loca,
zIndex: 10,
opacity: 1,
visible: true,
zooms: [2, 22],
depth: true,
});
var geo = new Loca.GeoJSONSource({
url: 'https://a.amap.com/Loca/static/loca-v2/demos/mock_data/data-line-out.json',
});
pulseLink.setSource(geo);
pulseLink.setStyle({
unit: 'meter',
dash: [40000, 0, 40000, 0],
lineWidth: function () {
return [20000, 1000];
},
height: function (index, feat) {
return feat.distance / 3 + 10;
},
// altitude: 1000,
smoothSteps: 30,
speed: function (index, prop) {
return 1000 + Math.random() * 200000;
},
flowLength: 100000,
lineColors: function (index, feat) {
return ['rgb(255,228,105)', 'rgb(255,164,105)', 'rgba(1, 34, 249,1)'];
},
maxHeightScale: 0.3, // 弧顶位置比例
headColor: 'rgba(255, 255, 0, 1)',
trailColor: 'rgba(255, 255,0,0)',
});
loca.add(pulseLink);
loca.animate.start();
})
.catch((e) => {
console.log(e);
});
},
},
};
</script>
<style scoped>
#container {
width: 100%;
height: 100%;
position: absolute;
cursor: pointer;
}
</style>
注意:
使用多个,key必须一致
禁止多种API加载方式混用
去掉html中的引入:<script type="text/javascript" src="http://webapi.amap.com/maps? v=1.4.15&key=key&plugin=AMap.Geocoder"></script>
边栏推荐
- [open source tutorial] DIY tutorial of 2020 new version of brushless power regulation [Author: I love loli love loli] (brief introduction and circuit construction)
- 科创人·酷渲科技创始人华少:用双赢思维做产品、连生态,实现规模化发展
- Mac MAMP Pro installation PHP extension method
- Summary of acl2020 information extraction related papers
- armcm3权威指南笔记
- 《微型Lisp解释器的构造与解释》的写作风格
- Record of error prone problems in PHP signature
- 进程间通信(IPC):信号量
- Global and Chinese markets of X-ray generators 2022-2028: Research Report on technology, participants, trends, market size and share
- build opencv3.4.16
猜你喜欢

The Mac OS MAMP installs redis with an error/ common. h:12:10: fatal error: ‘zend_ smart_ str.h‘ file not found

基于注意力的seq2seq模型

Canvas制作经典贪吃蛇

398-哈希表(242.有效的字母异位词 & 349. 两个数组的交集 & 202. 快乐数)

AI open day - how to optimize product and business revenue by adopting open source technology

Sentinel fusing and current limiting is really too slippery

Private board of directors of science and technology innovators · digital intelligence future (issue 4): demonstration of transformation - survivor bias and blind people touching elephants

PhpMyAdmin (MySQL) common shell writing methods

MAC MAMP PRO 安装PHP扩展方法

Sentinel熔断限流真的太丝滑了
随机推荐
Oraclelinux6.5 graphical installation Oracle11g
Qaudiooutput use
利用多核多线程进行程序优化
ssh-copy-id 批量免密脚本
SQL deadlock
工业级的内存拷贝函数实现
AI open day - how to optimize product and business revenue by adopting open source technology
Excel列数字索引转字符索引
进程间通信(IPC):信号量
After the code cloud creates a warehouse and associates it, the first submission always fails
Oracle database startup and shutdown
Canvas制作经典贪吃蛇
Don't know the latest version of kubernetes? An open class to solve all your questions
Sentinel fusing and current limiting is really too slippery
Double tower recall on the knowledge map: Ali's intentgc model
[qnx hypervisor 2.2 user manual]5.4 start VM
Object.assign() 对象合并和Object.keys()获取对象名
MYSQL 查询语句,替换结果
Implementation of industrial memory copy function
微服务之分布式事务Seata