Published
Edited
Dec 3, 2018
1 star
Insert cell
Insert cell
map = {
let container = html`<div style='height:400px;' />`;

yield container;

let map = new mapboxgl.Map({
container,
style: "mapbox://styles/mapbox/streets-v9",
center: [-79.4512, 43.6568],
zoom: 13,
scrollZoom: false
});

var geocoder = new MapboxGeocoder({
accessToken: mapboxgl.accessToken
});

map.addControl(geocoder);

invalidation.then(() => map.remove());
}
Insert cell
html`<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v2.3.0/mapbox-gl-geocoder.css' type='text/css' />`
Insert cell
MapboxGeocoder = require("mapbox-gl-geocoder@2.0.1/dist/mapbox-gl-geocoder.min.js")
Insert cell
mapboxgl = {
const gl = await require("mapbox-gl");
if (!gl.accessToken) {
gl.accessToken =
"pk.eyJ1IjoidG1jdyIsImEiOiJjamN0Z3ZiOXEwanZkMnh2dGFuemkzemE3In0.gibebYiJ5TEdXvwjpCY0jg";
const href = await require.resolve("mapbox-gl/dist/mapbox-gl.css");
document.head.appendChild(html`<link href=${href} rel=stylesheet>`);
}
return gl;
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more