Published
Edited
May 15, 2021
3 forks
4 stars
Insert cell
Insert cell
Insert cell
Insert cell
map = {
const svg = d3.create('svg').attr('viewBox', [0, 0, width, height]);

svg
.append('path')
.datum(border)
.attr('fill', 'white')
.attr('stroke', 'black')
.attr('d', path);

svg
.append('g')
.selectAll('path')
.data(topojson.feature(es, es.objects[active]).features)
.join('path')
.attr('fill', 'none')
.attr('stroke', 'black')
.attr('d', path);

svg
.append('path')
.attr('fill', 'none')
.attr('stroke', 'black')
.attr('d', projection.getCompositionBorders());

return svg.node();
}
Insert cell
border = topojson.mesh(es, es.objects.border)
Insert cell
projection = d3.geoConicConformalSpain().fitSize([width, height], border)
Insert cell
path = d3.geoPath().projection(projection)
Insert cell
height = 500
Insert cell
es = d3.json('https://unpkg.com/es-atlas@0.5.0/es/municipalities.json')
Insert cell
d3 = require('d3@6', 'd3-composite-projections@1.3')
Insert cell
topojson = require('topojson@3')
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