JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css">
<script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js"></script>
<div id="map"></div>
CSS
html, body, #map {
height: 100%;
width:100%;
padding:0px;
margin:0px;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
color: #333;
}
JavaScript
//////////////////////////////////////////////////////////////////////////////////////////////
//setting up the map//
//////////////////////////////////////////////////////////////////////////////////////////////
// set center coordinates
var centerlat = 34.05;
var centerlon = -118.25;
// set default zoom level
var zoomLevel = 11;
// initialize map
var map = L.map('map').setView([centerlat,centerlon], zoomLevel);
// set source for map tiles (in this case one of Mapbox's minimal example maps)
MB_ATTR = 'Map data © <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://mapbox.com">Mapbox</a>';
MB_URL = 'http://{s}.tiles.mapbox.com/v3/{id}/{z}/{x}/{y}.png';
// add tiles to map
L.tileLayer(MB_URL, {attribution: MB_ATTR, id: 'examples.map-szwdot65'}).addTo(map);
//////////////////////////////////////////////////////////////////////////////////////////////
//creating some synthetic GeoJSON data//
//////////////////////////////////////////////////////////////////////////////////////////////
//initialize
var dotlayer;
var dots;
var dotcount = 500;
//cheapo normrand function
function normish(mean, range) {
var num_out = ((Math.random() + Math.random() + Math.random() + Math.random() - 2) / 2) * range + mean;
return num_out;
}
//create geojson data with random ~normal distribution
function make_dots() {
dots = {
type: "FeatureCollection",
features: []
};
//set up random variables
x = normish(0, 2);
y = normish(0, 2);
//create points randomly distributed about center coordinates
var g = {
"type": "Point",
"coordinates":[-5 , 34.796931]
};
//create feature properties, with year roughly proportional to distance from center coordinates
var p = {
"id" : 1,
"popup":...