Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Leaflet.js Essentials

You're reading from   Leaflet.js Essentials Create interactive, mobile-friendly mapping applications using the incredibly light yet powerful Leaflet.js platform.

Arrow left icon
Product type Paperback
Published in Aug 2014
Publisher
ISBN-13 9781783554812
Length 180 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Heatmaps with Leaflet.heat

The first heatmap you will make will be a density heatmap, using the Leaflet.heat plugin. You can download the JavaScript plugin at https://github.com/Leaflet/Leaflet.heat. The following steps will walk you through creating your first heatmap:

  1. Using LeafletEssentials.html, add a reference to Leaflet.heat.js with either a URL to a remote copy or the path to your local copy, as shown in the following code:
    <script src="http://Leaflet.github.io/Leaflet.heat/dist/Leaflet-heat.js"></script> or,
    <script src="Leaflet-heat.js"></script>
  2. Add an array of points. Your points can contain additional information but must have the latitude and longitude as the first two elements. The following code shows you three points from the code. The full code contains many more, which will allow you to create the heatmap:
    var points = [
    [35.1555 , -106.591838 , "<img src='http://farm8.staticflickr.com/7153/6831137393_fa38634fd7_m.jpg...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image