Public
Edited
Apr 20, 2024
2 forks
2 stars
Insert cell
Insert cell
Insert cell
viewof map = {
const container = yield html`<div style="height:800px">`
const map = (container.value = new maplibregl.Map({
container,
zoom: 7.5,
center: [129.45159098652664, 33.64287234545043],
localIdeographFontFamily: '"Hiragino Maru Gothic ProN W4", "Meiryo", serif',
style: STYLE
}))
map.on('load', () => {
map.addControl(new maplibregl.FullscreenControl())
const { MapboxLayer, Tile3DLayer } = deck
const layer = new MapboxLayer({
id: '3d',
type: Tile3DLayer,
pointSize: 1.6,
data: TILESET_URL,
loader: loaders.Tiles3DLoader,
loadOptions: {
tileset: {
// viewDistanceScale: 1.2
}
}
})
map.addLayer(layer)
})
invalidation.then(() => map.remove());
}
Insert cell
Insert cell
// Smart Maps Bazaar にホストしている三次元タイルの tileset.json をここで指定しています。データを更新するごとに CID が変更されます。
//TILESET_URL = 'https://smb.optgeo.org/ipfs/QmdAr2FWQKCVv7CAcLRuTBt1583Qi7DA4gaA92g3ujeL1v/tileset.json'
TILESET_URL = 'https://data.source.coop/smartmaps/ngs/tileset.json'
Insert cell
// deck = require.alias({})('deck.gl@latest/dist/dist.dev.js')
deck = require('deck.gl@8/dist.min.js')
Insert cell
//loaders = require('@loaders.gl/3d-tiles@^2.3.0/dist/dist.js')
loaders = require('@loaders.gl/3d-tiles@^2.3.0/dist/dist.min.js')
Insert cell
pmtiles = import("https://cdn.skypack.dev/pmtiles")
Insert cell
maplibregl = {
let m = await require("maplibre-gl")
let protocol = new pmtiles.Protocol();
m.addProtocol("pmtiles",protocol.tile);
yield m
}
Insert cell
C2 = fetch("https://optgeo.github.io/c2/style.json").then((resp) => resp.json())
Insert cell
UNITE = fetch("https://optgeo.github.io/unite-one/style.json").then((resp) => resp.json())
Insert cell
STYLE = (() => {
// add source
C2.sources.unite = UNITE.sources.v

// add layer
let layer = UNITE.layers[0]
layer.source = 'unite'
C2.layers.splice(
C2.layers.findIndex(layer => {return layer.id == 'wa'}),
0,
layer
)
//C2.sources.v.url = "pmtiles://https://smb.optgeo.org/ipfs/QmPhPaV3UqjQFY5JAaRy4fQJY2nc5XEbgbSJLQ2A95udWi"
C2.sources.v.url = "pmtiles://https://cyberjapandata.gsi.go.jp/xyz/optimal_bvmap-v1/optimal_bvmap-v1.pmtiles"
C2.sources.v.minzoom = 7
delete C2.terrain
return C2
})()
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