Published
Edited
Aug 27, 2020
1 fork
6 stars
Insert cell
Insert cell
Insert cell
Insert cell
ca_img
Insert cell
ca_img.name
Insert cell
ca_img = FileAttachment('california-crop.png')
Insert cell
rtranslate_y = (height - raster_height) / 2.0;
Insert cell
rtranslate_x = (width - raster_width) / 2.0;
Insert cell
raster_height = (b[1][1] - b[0][1]) * s;
Insert cell
raster_width = (b[1][0] - b[0][0]) * s;
Insert cell
t = [(width - s * (b[1][0] + b[0][0])) / 2.0, (height - s * (b[1][1] + b[0][1])) / 2.0]
Insert cell
s = 0.95 / Math.max((b[1][0] - b[0][0]) / width, (b[1][1] - b[0][1]) / height)
Insert cell
b = path.bounds(topojson.feature(ca, ca.objects.california));

Insert cell
Insert cell
Insert cell
Insert cell
countyBoundaries.bounds
Insert cell
path.bounds
Insert cell
Insert cell
projection = d3.geoMercator()
.scale(1)
.translate([0, 0])
// .parallels([37 + 4 / 60, 38 + 26 / 60])
// .rotate([120 + 30 / 60], 0)
//.fitSize([width, height], landArea)
Insert cell
Insert cell
Insert cell
ca_outlineFeats = topojson.feature(ca_outline, ca_outline.objects['cb_2015_california_county_20m'])
Insert cell
ca_outline = FileAttachment("california_06_counties.json").json()
Insert cell
Insert cell
countyBoundaries = topojson.mesh(ca, ca.objects.california)
Insert cell
ca = FileAttachment("california.json").json()
Insert cell
Insert cell
Insert cell
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