Public
Edited
Aug 31, 2024
Insert cell
Insert cell
container = {
  yield html`<div style="height: 600px;">`
}
Insert cell
map = {
const maplibregl = await require('https://unpkg.com/maplibre-gl/dist/maplibre-gl.js')
await import('https://hfu.github.io/h3j-test/h3j_h3t.js')

const map = new maplibregl.Map({
"container": container,
"style": 'https://basemaps.cartocdn.com/gl/positron-gl-style/style.json',
"center": [-3.703622869000082, 40.41711423898472],
"zoom": 15, "pitch": 30,
})
console.log(map.addH3JSource) // no #addH3JSource available...

map.on('load', e => {
map.addH3JSource(
'h3j_testsource',
{
"data": 'sample.h3j',
"attribution": "© <a href='https://www.inspide.com/'>Inspide</a>"
}
).then(m => m.addLayer({
"id": 'h3j_testlayer',
"type": 'fill-extrusion',
"source": 'h3j_testsource',
'paint': {
'fill-extrusion-color': [
'interpolate-lab',
['linear'],
['get', 'value'],
0, '#430254',
21.864, '#f83c70'
],
'fill-extrusion-height': [
'interpolate',
['linear'],
['zoom'],
14,
0,
15.05,
['*', 10, ['get', 'value']]
],
'fill-extrusion-opacity': 0.7
}
})
)
})
yield map
}
Insert cell
<link href="https://unpkg.com/maplibre-gl/dist/maplibre-gl.css" rel="stylesheet" />
Insert cell
aaa = {
const bundle = await import('https://hfu.github.io/h3j-test/module.js');
const maplibregl = bundle.maplibregl;

// ... Initialize map as before
}
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