Published
Edited
Nov 21, 2018
Insert cell
Insert cell
plot = {
const projection = d3.geoMercator().center([-74.83,10.99]).scale(scale)
// .translate([0, 0]);
const path = d3.geoPath().projection(projection);
const svg = d3.select(DOM.svg(width, height))
.style("width", "100%")
.style("height", "auto");

// return topojson.feature(us, us.objects.land)
const newSvg = ready(svg, path, col, projection).node();
return newSvg
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
function ready(svg, path, us, projection) {
svg.append("path")
.datum(topojson.feature(us, us.objects.COL_adm1))
.attr("class", "land")
.attr("d", path);

// svg.append("path")
// .datum(topojson.mesh(us, us.objects.states, function(a, b) { return a !== b; }))
// .attr("class", "states")
// .attr("d", path);
return svg;
}
Insert cell
Insert cell
weatherStations = d3.json("https://geojson-ldxdcwirxw.now.sh/metar-api-sample-json-10945.json")


Insert cell
us = d3.json("https://geojson-ufpskuwfiq.now.sh/us.json")
Insert cell
col = d3.json("https://file-zntbefnosg.now.sh")
Insert cell
topojson = require("topojson-client@3")
Insert cell
d3 = require("https://d3js.org/d3.v5.min.js")
Insert cell
import {slider, color} from "@jashkenas/inputs"
Insert cell
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