Published
Edited
Dec 23, 2020
1 star
Insert cell
Insert cell
Insert cell
Insert cell
featherfile = trifeather.TriFeather.from_feature_collection(geojson, projection)
Insert cell
Insert cell
projection = d3.geoNaturalEarth1().scale(1e6)
Insert cell
trifeather = require("trifeather@1.0.4")
Insert cell
geojson = fetch(url).then(d=>d.json())
Insert cell
function download_button(feather) {return html`
<h3>${filename} (${mb(feather.bytes.length)})</h3>
${DOM.download(new Blob([feather.bytes.buffer], {type: "application/octet-stream"}), `${filename}.trifeather`, `Download ${feather.t.length} row file)`)}`}
Insert cell
filename = url.split("/").reverse()[0].replace(".json", "").replace(".geojson", "")
Insert cell
mb = function(string) {
if (string < 1024 * 1024) {
return d3.format(",.3")(string/1024) + "KB"
}
return d3.format(",.3")(string/1024/1024) + "MB"
}
Insert cell
d3 = require("d3@v6")
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