UNPKG

mapv

Version:

a library of geography visualization

75 lines (61 loc) 1.82 kB
<!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: parseInt(8 * Math.random()) }); } var dataSet = new mapv.DataSet(data); var options = { size: 5, splitList: [ { start: 0, end: 2, value: 'red' }, { start: 2, end: 4, value: 'yellow' }, { start: 4, value: 'blue' } ], max: 30, draw: 'choropleth' } var mapvLayer = mapv.leafletMapLayer(dataSet, options).addTo(map); </script> </body> </html>