Published
Edited
May 25, 2019
2 forks
5 stars
Insert cell
Insert cell
{
const mapboxgl = await require("mapbox-gl");
const mapboxGlGeocoder = await require('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.3.0/mapbox-gl-geocoder.min.js');

let container = html`<div style='height:600px;' />`;

mapboxgl.accessToken = 'pk.eyJ1IjoibGF0aW1lcyIsImEiOiJjajhvcXRraGUwNnlwMzNyczR3cTBsaWh1In0.0cPKLwe2A0ET4P5CtWSiLQ';

const map = new mapboxgl.Map({
container: container,
style: 'mapbox://styles/mapbox/streets-v11',
center: [-58.4473, -34.6229],
zoom: 9
});
map.addControl(new mapboxGlGeocoder({
accessToken: mapboxgl.accessToken,
mapboxgl: mapboxgl
}));
const href = await require.resolve("mapbox-gl/dist/mapbox-gl.css");
document.head.appendChild(html`<link href=${href} rel=stylesheet>`);

const href2 = await require.resolve('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.3.0/mapbox-gl-geocoder.css')
document.head.appendChild(html`<link href=${href2} rel=stylesheet>`);

yield container
}
Insert cell
html`<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.3.0/mapbox-gl-geocoder.css' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v1.0.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v1.0.0/mapbox-gl.css' rel='stylesheet' />`
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