Public
Edited
Mar 8, 2023
Insert cell
Insert cell
svg`<svg width = ${width} height = ${height}>
${tile().map(([x, y, z], i, {translate: [tx, ty], scale: k}) => svg`
<image xlink:href="${getHillShade(x, y, z)}" x="${Math.round((x + tx) * k)}" y="${Math.round((y + ty) * k)}" width="${k}" height="${k}">
`)}


</svg>`
Insert cell
${tiles.map(t => svg`
<path fill = 'darkgrey' d = "${path(t.data.water)}" /> <path stroke = 'black' fill = 'none' d = "${path(t.data.roads)}" />` )}
Insert cell
Insert cell
projection = d3.geoMercator()
.center([-122.916611, 48.636669])
.scale(Math.pow(2, 21) / (2 * Math.PI) )
.translate([width / 2, height / 2])
Insert cell
path = d3.geoPath(projection)
Insert cell
Insert cell
tile = d3.tile()
.size([width, height])
.scale(projection.scale() * 2 * Math.PI)
.translate(projection([0, 0]))
Insert cell
Insert cell
tiles = {
return Promise.all(tile().map(async d => {
d.data = await fetch(`https://tile.nextzen.org/tilezen/vector/v1/256/all/${d[2]}/${d[0]}/${d[1]}.json?api_key=-M9QAjq_QHSaJVfspNI_eA`).then(res => res.json())

return d
}))
}


Insert cell
Insert cell
function getHillShade(x, y, z) {
return `https://server.arcgisonline.com/ArcGIS/rest/services/Elevation/World_Hillshade/MapServer/tile/${z}/${y}/${x}.png`
}
Insert cell
height = 500
Insert cell
d3 = require("d3-geo@2", "d3-tile@1")
Insert cell
Insert cell
Insert cell
imageList.map(block => {
return [{block: block.block, text: block.text}, ...block.images]
}).flat(2)
Insert cell
imageList[0].images
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