Public
Edited
Apr 22
Insert cell
Insert cell
viewof mas = multiAutoSelect({
options: pointsLookup,
submit: "GUESS",
size: 26,
placeholder: "Select an airport"
//value: ["California", "Washington"]
})
Insert cell
mas
Insert cell
pointsLookup2 = Object.keys(data).map(function (key) {
let row = data[key];
return `${key} - ${row.name} (${row.city_name}, ${row.country})`;
})
Insert cell
pointsLookup = train_stations_europe.map((d) => {
return `${d.uic} - ${d.name_norm} (${d.country})`;
})
Insert cell
train_stations_europe.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
goals = {
const formatYearAndDate = d3.timeFormat("%Y %j");
const yearAndDate = parseInt(
formatYearAndDate(Date.now()).split(" ").join("")
);
return {
goalWords: d3
.shuffler(d3.randomLcg(yearAndDate))(pointsLookup.slice())
.slice(0, 1)
};
}
Insert cell
orig = airports.filter((d) => d.name === goals.goalWords[0])[0]
Insert cell
orig2 = points.filter((d) => d.name === goals.goalWords[0])[0]
Insert cell
import { multiAutoSelect } from "@cadasa/shape"
Insert cell
import { View } from "@mbostock/synchronized-views"
Insert cell
mutable destination = []
Insert cell
turf = require("@turf/turf")
Insert cell
viewof route2 = new View({})
Insert cell
gnbyname = new Map(mas.map((value, key) => [value, key + 1]))
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
myairports = FileAttachment("myairports.json").json()
Insert cell
data = fetch(
`https://raw.githubusercontent.com/Jonty/airline-route-data/main/airline_routes.json`
).then((response) => response.json())
Insert cell
Insert cell
airports = train_stations_europe.map((d) => {
return {
code: d.uic,
name: `${d.uic} - ${d.name_norm} (${d.country})`,
lat: +d.latitude,
lon: +d.longitude
};
})
Insert cell
import { radio, button } from "@jashkenas/inputs"
Insert cell
mapboxgl = {
const gl = require("mapbox-gl@2");
if (!gl.accessToken) {
// token allowed only this Observable
gl.accessToken =
"pk.eyJ1IjoidG9mZmkiLCJhIjoiY2lvMDBxMzR3MDB1eHZza2x4NGI2YjI5OSJ9.IEaNA05pWbT92nOu-lEOYw";
const href = await require.resolve("mapbox-gl@2/dist/mapbox-gl.css");
document.head.appendChild(html`<link href=${href} rel=stylesheet>`);
}
return gl;
}
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