我想将热图放在ngx-leaflet贴图上(使用angular),如下图所示。
我怎样才能做到这一点呢?

以下是示例的demo。
发布于 2019-02-25 17:15:00
安装leaflet、ngx-leaflet、@types/leaflet
npm install leaflet
npm install leaflet.heat
npm install @asymmetrik/ngx-leaflet
npm install --save-dev @types/leaflet在angular.json中导入leaflet.css
"styles": ["../node_modules/leaflet/dist/leaflet.css", "styles.css"]在comp.ts上安装并导入Leaflet.heat,从assets导入要使用的地理数据
import 'leaflet.heat/dist/leaflet-heat.js'
import { addressPoints } from '../assets/realworld.10000'侦听onMapReady事件,获取对地图的引用并将热点图添加到地图
onMapReady(map) {
let newAddressPoints = addressPoints.map(function (p) { return [p[0], p[1]]; });
const heat = L.heatLayer(newAddressPoints).addTo(map);
}https://stackoverflow.com/questions/54858755
复制相似问题