Public
Edited
Apr 5, 2023
Insert cell
Insert cell
viewof form = Inputs.form({
projection: Inputs.select(['equal-earth', 'orthographic'], {label: 'Projection'}),
lat: Inputs.range([-90,90], {label: 'Latitude'}),
long: Inputs.range([-90,90], {label: 'Longitude'})
})
Insert cell
Plot.plot({ // plot library, using a series of marks (think like layers)
projection: {
type: form.projection, // use this projection...
rotate: [form.lat,-form.long]
},
width: 400,
marks: [
Plot.geo(world110m, {
//fill: "#eee",
fill: d => {
if (d.id == 'USA') {return 'blue'}
else if (d.id == 'CHN') {return 'red'}
else return '#eee'},
stroke: '#ccc' }), // to plot this geo and fill with black
Plot.geo(usstates, { stroke: '#ccc' }),
// Plot.graticule(), // lat/long lines
Plot.sphere({stroke: '#ccc'}) // outer border of visual
]
})
Insert cell
land = topojson.feature(land50m, land50m.objects.land)
Insert cell
land50m = FileAttachment("land-50m.json").json()
Insert cell
import {basemaps} from "@emfielduva/dvlib_maps"
Insert cell
world110m = (await basemaps.world110m.geojson).json()
Insert cell
usstates = (await basemaps.us_states20m.geojson).json()
Insert cell
//cville = d3.json("https://opendata.arcgis.com/datasets/c371ad0b81024822bad1147ff")
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