A Leaflet.js map created with Folium- click on the markers to see the Vincent/Vega visualization. To see the Python code used to create the visualizations, see the [Gist](A Leaflet.js map created with Folium. This map was generated with the following Python code:). The map was generated with the following Python code:
buoy_map = folium.Map(location=[46.3014, -123.7390], zoom_start=7,
tiles='Stamen Terrain')
buoy_map.polygon_marker([47.3489, -124.708], fill_color='#43d9de', radius=12,
popup=(vis1, 'vis1.json'))
buoy_map.polygon_marker([44.639, -124.5339], fill_color='#43d9de', radius=12,
popup=(vis2, 'vis2.json'))
buoy_map.polygon_marker([46.216, -124.1280], fill_color='#43d9de', radius=12,
popup=(vis3, 'vis3.json'))
buoy_map.create_map(path='NOAA_buoys.html')
xxxxxxxxxx
<head>
<link rel="stylesheet" href="https://cdn.leafletjs.com/leaflet-0.5/leaflet.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.5/leaflet.min.js"></script>
<script src="leaflet-dvf.markers.min.js"></script>
<script src="https://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="https://trifacta.github.com/vega/vega.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<style>
#map {
position:absolute;
top:0;
bottom:0;
right:0;
left:0;
}
</style>
</head>
<body>
<div id="map" style="width: 960px; height: 500px"></div>
<script>
function parse(spec, div) {
vg.parse.spec(spec, function(chart) { chart({el:div}).update(); });
}
var map = L.map('map').setView([46.3014, -123.739], 7);
L.tileLayer('https://{s}.tile.stamen.com/terrain/{z}/{x}/{y}.jpg', {
maxZoom: 18,
attribution: 'Map tiles by <a href="https://stamen.com">Stamen Design</a>, under <a href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="https://openstreetmap.org">OpenStreetMap</a>, under <a href="https://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>.'
}).addTo(map);
var polygon_1 = new L.RegularPolygonMarker(new L.LatLng(47.3489, -124.708), {
color: 'black',
opacity: 1,
weight: 2,
fillColor: '#43d9de',
fillOpacity: 1,
numberOfSides: 4,
rotation: 0,
radius: 12
});
polygon_1._latlng = polygon_1._centerLatLng
polygon_1.on('click', function() {
var div = $('<div id="vis1" style="width: 675px; height: 250px;"></div>')[0];
polygon_1.bindPopup(div);
polygon_1._popup.options.maxWidth = 960;
polygon_1.openPopup();
parse('vis1.json', '#vis1');
});
map.addLayer(polygon_1)
var polygon_2 = new L.RegularPolygonMarker(new L.LatLng(44.639, -124.5339), {
color: 'black',
opacity: 1,
weight: 2,
fillColor: '#43d9de',
fillOpacity: 1,
numberOfSides: 4,
rotation: 0,
radius: 12
});
polygon_2._latlng = polygon_2._centerLatLng
polygon_2.on('click', function() {
var div = $('<div id="vis2" style="width: 675px; height: 250px;"></div>')[0];
polygon_2.bindPopup(div);
polygon_2._popup.options.maxWidth = 960;
polygon_2.openPopup();
parse('vis2.json', '#vis2');
});
map.addLayer(polygon_2)
var polygon_3 = new L.RegularPolygonMarker(new L.LatLng(46.216, -124.128), {
color: 'black',
opacity: 1,
weight: 2,
fillColor: '#43d9de',
fillOpacity: 1,
numberOfSides: 4,
rotation: 0,
radius: 12
});
polygon_3._latlng = polygon_3._centerLatLng
polygon_3.on('click', function() {
var div = $('<div id="vis3" style="width: 675px; height: 250px;"></div>')[0];
polygon_3.bindPopup(div);
polygon_3._popup.options.maxWidth = 960;
polygon_3.openPopup();
parse('vis3.json', '#vis3');
});
map.addLayer(polygon_3)
</script>
</body>
Modified http://cdn.leafletjs.com/leaflet-0.5/leaflet.js to a secure url
Modified http://d3js.org/d3.v3.min.js to a secure url
Modified http://trifacta.github.com/vega/vega.js to a secure url
Modified http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js to a secure url
https://cdn.leafletjs.com/leaflet-0.5/leaflet.js
https://d3js.org/d3.v3.min.js
https://trifacta.github.com/vega/vega.js
https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js