Published
Edited
Aug 13, 2019
Insert cell
Insert cell
d3 = require('d3@5')
Insert cell
topojson = require('topojson-client')
Insert cell
// https://martinjc.github.io/UK-GeoJSON/
edmap = d3.json('https://gist.githubusercontent.com/sarah37/829eca7234d52f596c31537d09d95f94/raw/c4897285a9fcf537b61fc5d32f82abd037666ac8/edinburgh.json')
Insert cell
projection = d3.geoMercator().fitSize([width, width], topojson.mesh(edmap))
Insert cell
map1 = {
const height = width;
const path = d3.geoPath().projection(projection)

const svg = d3.select(DOM.svg(width, height))
svg.datum(topojson.mesh(edmap))
.append('path')
.attr('d', path)
.style('fill', 'none')
.style('stroke', 'black')
.style('stroke-width', '1px')

return svg.node()
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more