Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to load the effect of Thermal Map in Leaflet

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to load the heat map effect in Leaflet, which has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, let the editor take you to understand it.

Leaflet is an open source JavaScript class library for interactive maps on the desktop and mobile. The size of the JS library is about 38k after compression, and it has all the map functions that developers need.

Leaflet maintains the design idea of simplicity, performance and practicality. It works efficiently on all major desktop and mobile platforms and can extend plug-ins. It has a beautiful, easy-to-use and well-documented API, and a simple, easy-to-read source code.

Heatmap.js is a lightweight, easy-to-use js class library, through the library reference, you can easily create a heat map, the address on github is https://github.com/pa7/heatmap.js, which provides a number of examples, including Leaflet or Google Maps.

Load the thermal map on Leaflet, and there is a ready-made class library. The specific usage is as follows:

Reference heatmap.js, and then reference heatmap.js/plugins/leaflet-heatmap/leaflet-heatmap.js, and develop according to the sample code on example. The following is a sample development based on the actual data. For specific parameters, please see the page description on github.

/ / load the corresponding class library

Require (['leaflet-heatmap'], function (HeatmapOverlay) {

/ / json request data

$.getJSON ('sampledata/ta_school.json', function (data) {

/ / set parameters

Var cfg = {

Radius: .007

"maxOpacity": .65

"scaleRadius": true

"useLocalExtrema": true

LatField: 'cy'

LngField: 'cx'

ValueField: 'cnt'

}

/ / define the thermal map

Var heatmapLayer = new HeatmapOverlay (cfg)

HeatmapLayer.setData (data)

LayerControl.addOverlay (heatmapLayer, thermal map)

});

});

Thank you for reading this article carefully. I hope the article "how to load the Thermal Map effect in Leaflet" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 252

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report