Leaflet Data Example

by will cadell

HTML

<script src="http://leafletjs.com/dist/leaflet.js"></script>
<script src="http://leafletjs.com/examples/us-states.js"></script>
<link rel="stylesheet" href="http://leafletjs.com/dist/leaflet.css">
<div id="map"></div>

CSS

#map {
		    width: 800px;
		    height: 500px;
		}
		.info {
		    padding: 6px 8px;
		    font: 14px/16px Arial, Helvetica, sans-serif;
		    background: white;
		    background: rgba(255, 255, 255, 0.8);
		    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
		    border-radius: 5px;
		}
		.info h4 {
		    margin: 0 0 5px;
		    color: #777;
		}
		.legend {
		    text-align: left;
		    line-height: 18px;
		    color: #555;
		}
		.legend i {
		    width: 18px;
		    height: 18px;
		    float: left;
		    margin-right: 8px;
		    opacity: 0.7;
		}

JavaScript

var map = L.map('map').setView([37.8, -96], 4);

var stamenLayer = L.tileLayer('https://stamen-tiles-{s}.a.ssl.fastly.net/toner/{z}/{x}/{y}.png', {
    attribution: 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="http://openstreetmap.org">OpenStreetMap</a>, under <a href="http://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>.'
}).addTo(map);