Published
Edited
Jul 30, 2020
Insert cell
Insert cell
Insert cell
Insert cell
viewof radius = md`<input type=range min=0.000 max=0.08 value=0.05 step=0.0001>`
Insert cell
viewof large = md`<input type=range min=1 max=800 value=1 step=0.0001>`
Insert cell
Insert cell
Insert cell
d3 = require(fix ? "d3-geo@2.0.0-rc.2" : "d3-geo@1")
Insert cell
d3.fsum
Insert cell
viewof fix = html`<input type=checkbox>`
Insert cell
Insert cell
map22 = {
const canvas = DOM.canvas(width, width / 2),
context = canvas.getContext("2d"),
path = d3.geoPath(projection).context(context);

var C = d3
.geoCircle()
.center([11.0001, 0])
.radius(0.43382752)();

var a = C.coordinates[0],
b = a.slice().reverse();

var centroida = d3.geoCentroid(C);

C.coordinates[0] = b;

var centroidb = d3.geoCentroid(C);

//projection.fitExtent([[10,10],[width-10, width/2-10]], C);

context.beginPath(),
path(C),
(context.fillStyle = "lightblue"),
context.fill();
context.stroke();
context.beginPath(),
path({ type: "Point", coordinates: centroida }),
(context.fillStyle = "blue"),
context.fill();
context.beginPath(),
path({ type: "Point", coordinates: centroidb }),
(context.strokeStyle = "orange"),
(context.lineWidth = "3"),
context.stroke();
context.beginPath(),
path(d3.geoGraticule()()),
(context.strokeStyle = "#aaa"),
(context.lineWidth = "1"),
context.stroke();

return canvas;
}
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