Published
Edited
Sep 10, 2019
Insert cell
md`# area: map/geographic coordinate system`
Insert cell
chart = {
const svg = d3.select(DOM.svg(width, height))
.style("width", "40%")
.style("height", "auto")
.style("font", "10px sans-serif");

svg.selectAll("path")
.data(subunits.features)
.enter()
.append("path")
.attr("d", mapPath)
;

return svg.node();
}
Insert cell
projection = d3.geoMercator()
.center([-3, 40])
.scale([1300])
.translate([width/2,height/2])
;
Insert cell
mapPath = d3.geoPath()
.projection(projection)
;
Insert cell
width = 300
Insert cell
height = 300
Insert cell
subunits = topojson.feature(data, data.objects.subunits)
Insert cell
topojson = require("topojson-client@3")
Insert cell
data = d3.json("https://gist.githubusercontent.com"
+ "/aaronxhill/cc1ee2394eb7eb9e42b57a3e0f14e458"
+ "/raw/889e38c6dbcc6b4fcca0bdbce583a12131c6b0ca"
+ "/esp.json")
//https://gist.github.com/aaronxhill/cc1ee2394eb7eb9e42b57a3e0f14e458/raw/889e38c6dbcc6b4fcca0bdbce583a12131c6b0ca/esp.json
Insert cell
d3 = require("d3@5", "topojson")
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