Published
Edited
Oct 30, 2020
2 stars
Insert cell
Insert cell
Insert cell
projection = d3.geoNaturalEarth1().rotate(rotate)
Insert cell
{
const selection = d3Selection.select(map);
const canvas = selection.node();
const context = canvas.getContext("2d");
const path = d3.geoPath(projection)
.context(context)
.pointRadius(20);

context.beginPath();
context.fillStyle = "tomato";
for (let i = 0, l = myGeoJSON.features.length; i < l; i++){
const feature = myGeoJSON.features[i];
path(feature);
}
context.fill()
return canvas;
}
Insert cell
myGeoJSON = ({
type: "FeatureCollection",
features: [
{
type: "Point",
coordinates: [90, 0]
},
{
type: "Point",
coordinates: [-90, 0]
}
]
})
Insert cell
import {d3, map} with {projection} from "@d3/world-map"
Insert cell
d3Selection = require("d3-selection@2")
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