Published
Edited
Dec 21, 2018
3 forks
5 stars
Insert cell
Insert cell
{
let container = html`<div style='height:600px;' />`;

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.eyJ1IjoibGF0aW1lcyIsImEiOiJjajhvcXRraGUwNnlwMzNyczR3cTBsaWh1In0.0cPKLwe2A0ET4P5CtWSiLQ";
const href = await require.resolve("mapbox-gl/dist/mapbox-gl.css");
document.head.appendChild(html`<link href=${href} rel=stylesheet>`);
}
return gl;
}
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