看了Mapv的源码才发现,它是支持 Leaflet 地图的,Mapv作者也是有和Leaflet地图结合的案例的,但是直接百度 “Mapv Leaflet” 却没有结果,为了补全这个空缺,所以写了这个博客
原文链接:https://github.com/huiyan-fe/mapv/blob/master/examples/leaflet
使用案例:
<!DOCTYPE html>
<html>
<head>
<title>maptalks example</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css">
<style>
html,
body,
#map {
height: 100%;
padding: 0;
margin: 0;
}
</style>
</head>
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js"></script>
<script src="../../build/mapv.js"></script>
<script>
var map = L.map('map').setView([34.41583177128595, -102.17609405517578], 5);
L.tileLayer('http://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png', {
'subdomains': ['a', 'b', 'c', 'd', 'e']
}).addTo(map);
var randomCount = 300;
var data = [];
while (randomCount--) {
data.push({
geometry: {
type: 'Point',
coordinates: [-125.8 + Math.random() * 50, 30.3 + Math.random() * 20]
},
count: 30 * Math.random()
});
}
var dataSet = new mapv.DataSet(data);
var options = {
fillStyle: 'rgba(255, 250, 50, 0.8)',
globalCompositeOperation: "lighter",
maxSize: 10,
max: 30,
shadowBlur: 30,
shadowColor: 'rgba(255, 250, 50, 1)',
draw: 'bubble'
};
//这一句是唯一和百度地图不同的一处
var mapvLayer = mapv.leafletMapLayer(dataSet, options).addTo(map);
</script>
</body>
</html>
来源:CSDN
作者:早晨阳光一般暖
链接:https://blog.csdn.net/LZY_1993/article/details/103226808