What is the recommended way to import maplibre-gl and deck-gl libraries (and associated css) into Observable Framework?
Salut Nicolas,
Hereās how I import maplibre-gl, with its css and js locally hosted:
https://observablehq.observablehq.cloud/pangea/party/maplibre-gl
Itās possible that the same pattern works for deck.gl, but I havenāt tried yet. Let me know if you get it to work?
Note that if you prefer, you could combine the css and js cells into one like so:
```js
display(html`<link rel="stylesheet" href="${import.meta.resolve("npm:maplibre-gl/dist/maplibre-gl.css")}">`);
import maplibregl from "npm:maplibre-gl";
```
Thanks a lot.
What is import.meta.resolve()
?
Actually, I canāt import deck-gl with import
. The only way is
<script src="https://unpkg.com/deck.gl@latest/dist.min.js"></script>
But I donāt know if itās a good way.
Ah, if I try to import
import deck from "npm:deck.gl"
I get this error:
unable to fetch: https://cdn.jsdelivr.net/npm/@loaders.gl/compression@undefined/package.json
We need to investigate a better solution for deck.gl, but for now hot-linking to unpkg seems to be the only thing that works.
DeckGL!
```js
import deck from "npm:deck.gl/dist.min.js/+esm";
```
demo:
https://observablehq.observablehq.cloud/pangea/party/deck.gl.html
Hello Fil.
Iām interested to have a look to the code source behind this map.
https://observablehq.observablehq.cloud/pangea/party/deck.gl-map
Is it possible?
yep there is a tiny button with a link to the source at the top right (itās normal you didnāt see it, as itās hidden by a big O ā I have to move it somewhere else)
Iāve seen it. But it links to a 404 error page.
hmmmā¦ try this one pangea/docs/party/deck.gl-map.md at main Ā· Fil/pangea Ā· GitHub
Note that this is not āofficial documentationā, itās just a playground where Iām trying things out, and changing everything all the time. Something more serious will definitely come out of this chaos, in the near future.
It works. Yes, I understood it was a playground. But it helps.
The documentation page for deck.gl now lives at deck.gl | Observable Framework
Well done