UNPKG

mapv

Version:

a library of geography visualization

60 lines (48 loc) 1.81 kB
<!DOCTYPE html> <html> <head> <title>Leaflet.Canvas example</title> <!-- based on leaflet quick example: http://leafletjs.com/examples/quick-start-example.html --> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" /> <!--[if lte IE 8]> <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.ie.css" /> <![endif]--> <style> html, body, #map { height: 100%; padding: 0; margin: 0;} </style> </head> <body> <div id="map"></div> <script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script> <script src="../build/mapv.js"></script> <script> var map = L.map('map').setView([0.0, -40.0], 2); L.tileLayer('http://{s}.tile.stamen.com/toner/{z}/{x}/{y}.png', { maxZoom: 18, attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery <a href="http://stamen.com">Stamen</a>' }).addTo(map); var randomCount = 500; 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.7)', shadowColor: 'rgba(255, 255, 50, 1)', shadowBlur: 10, size: 3, draw: 'simple' } var mapvLayer = mapv.leafletMapLayer(map, dataSet, options); </script> </body> </html>