Skip to content

Instantly share code, notes, and snippets.

@DanRunfola
Created August 25, 2014 16:59
Show Gist options
  • Save DanRunfola/e02f75d222a7b707b7ca to your computer and use it in GitHub Desktop.
Save DanRunfola/e02f75d222a7b707b7ca to your computer and use it in GitHub Desktop.
Test
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href='//cdn.leafletjs.com/leaflet-0.5.1/leaflet.css'>
<script src='//cdn.leafletjs.com/leaflet-0.5.1/leaflet.js' type='text/javascript'></script>
<script src='//rawgithub.com/leaflet-extras/leaflet-providers/gh-pages/leaflet-providers.js' type='text/javascript'></script>
<script src='//harrywood.co.uk/maps/examples/leaflet/leaflet-plugins/layer/vector/KML.js' type='text/javascript'></script>
<style>
.rChart {
display: block;
margin-left: auto;
margin-right: auto;
width: 800px;
height: 400px;
}
</style>
</head>
<body >
<div id = 'chart7' class = 'rChart leaflet'></div>
<script>
var spec = {
"dom": "chart7",
"width": 800,
"height": 400,
"urlTemplate": "http://{s}.tile.osm.org/{z}/{x}/{y}.png",
"layerOpts": {
"attribution": "Map data<a href=\"http://openstreetmap.org\">OpenStreetMap</a>\n contributors, Imagery<a href=\"http://mapbox.com\">MapBox</a>"
},
"center": [ 51.505, -0.09 ],
"zoom": 13,
"id": "chart7"
}
var map = L.map(spec.dom, spec.mapOpts)
map.setView(spec.center, spec.zoom);
if (spec.provider){
L.tileLayer.provider(spec.provider).addTo(map)
} else {
L.tileLayer(spec.urlTemplate, spec.layerOpts).addTo(map)
}
L
.marker([
51.5,
-0.09
])
.addTo( map )
.bindPopup("<p> Hi. I am a popup </p>")
L
.marker([
51.495,
-0.083
])
.addTo( map )
.bindPopup("<p> Hi. I am another popup </p>")
if (spec.circle2){
for (var c in spec.circle2){
var circle = L.circle(c.center, c.radius, c.opts)
.addTo(map);
}
}
</script>
<script></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment