Public
Edited
Apr 7
Insert cell
Insert cell
Insert cell
map = {
const container = yield htl.html`<div style="height: 500px;">`;
const map = L.map(container).setView([46.72, 7.862311288115387], 8);
L.tileLayer("https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}", {
attribution: "Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community"
}).addTo(map);

//Default marker
L.marker([46.461599599561545, 7.862311288115387],
{
title: "Switzerland",
opacity: 0.9,
riseOnHover: true}).bindPopup("Switzerland. Full of mountains, cheese and chocolates and with French, German and Italian influences, Switzerland is a great place to visit.").
addTo(map);

//Custom marker
L.marker([45.98142514598109, 7.659203753876486],
{ icon: mountainIcon,
title: "The Matterhorn",
opacity: .9,
riseOnHover: true}).bindPopup("Fun fact: When the famous chocolate, Toblerone, relocated their factory out of Switzerland they had to take the Matternhorn off their recognizable triangular chocolate boxes. You can only use Swiss branding if your company is Switerland-based.").
addTo(map);

//Circle markers
circleAttributes.forEach(function(item) {
L.circleMarker([item.lat, item.lng],
{ radius: item.population/10000
}).bindPopup(item.name + " has a population of " + item.population).addTo(map);
});

}
Insert cell
//Circle marker attributes
circleAttributes = [
{ lat: 47.3666667, lng: 8.55, name: "Zurich", population: 435000},
{ lat: 46.2, lng: 6.1666667, name: "Geneva", population: 202000},
{ lat: 47.5666667, lng: 7.6, name: "Basel", population: 180000},
{ lat: 46.9166667, lng: 7.4666667, name: "Bern", population: 144000},
{ lat: 46.519654, lng: 6.632273, name: "Lausanne", population: 140000},

];
Insert cell
Insert cell
mountain = FileAttachment("filledInMountainBlue.png").url()
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more