Public
Edited
Sep 30, 2023
Insert cell
# Cebu Ferry Connections
Insert cell
ferries = (await fetch("https://gist.githubusercontent.com/budots2/a177816bd3b571ce216c786aa81e0b07/raw/bc1c927b4d9c2e17c3007383a4fcaed130249836/cebu-ferry-connections.geojson")).json()
Insert cell
chart = {
const width=400, height=600;
const svg = d3.select(DOM.svg(width, height))
// Use Mercator projection
var projection = d3.geoMercator()
// Powerfull stuff! I didnt know where exactly my dataset was located projection-wise,
// but .fitExtent() allows you to fit your dataset within a specified canvas
.fitExtent([[20, 20], [width, height]], ferries);

var path = d3.geoPath()
.projection(projection);
// Draw each province as a path
svg.append('g').selectAll('path')
.data(ferries.features)
.enter().append('path')
.attr('d', path)
// Styling
.style('fill', 'white')
.style('stroke', '#ccc')
return svg.node()
}
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