Skip to content

Instantly share code, notes, and snippets.

@mpmckenna8
Forked from stevevance/gist:13a27dc2d223807ef334
Last active August 29, 2015 14:06
Show Gist options
  • Save mpmckenna8/eed4f47e6d302149862e to your computer and use it in GitHub Desktop.
Save mpmckenna8/eed4f47e6d302149862e to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Leaflet w/ geojson Polygons & addStyle()</title>
<script type="text/javascript" src="http://leaflet.cloudmade.com/dist/leaflet.js"></script>
<link rel="stylesheet" href="http://leaflet.cloudmade.com/dist/leaflet.css" />
<!--[if lte IE 8]><link rel="stylesheet" href="http://leaflet.cloudmade.com/dist/leaflet.ie.css" /><![endif]-->
<script type="text/javascript" src="http://maps.stamen.com/js/tile.stamen.js?v1.2.3"></script>
<script type="text/javascript" src="./other.geojson" ></script>
<style type="text/css">
#map {
width: 600px;
height: 400px;
margin: 0 0 1em 0;
margin-right:auto;
margin-left:auto;
}
</style>
</head>
<body onload="initialize()">
<div id="map" ></div>
<script type="text/javascript">
function initialize() {
var watercolor = new L.StamenTileLayer("watercolor");
var terrain = new L.StamenTileLayer("terrain");
var toner= new L.StamenTileLayer("toner");
var bases = {
"Watercolor":watercolor,
"Terrain":terrain,
"Toner":toner
}
var map = new L.Map('map', {
center: [41.85,-87.75],
zoom:11,
layers:toner
})
var bosBords = L.geoJson().addTo(map);
bosBords.addData(bords)
.setStyle(
{fillColor:'#54278f',
color:'pink',
fillOpacity:.8
}
);
// L.control.layers(bases).addTo(map);
//console.log()bords.features.properties.DISTRICT)).map();
}
// ([37.75, -122.45], 12)
</script>
</body>
</html>
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment