Public
Edited
Mar 30, 2024
3 forks
Insert cell
Insert cell
<svg width="1000" height="500"></svg>
Insert cell
map = d3.select(mapContainer)
Insert cell
Insert cell
Insert cell
world = FileAttachment("world-110m.geo.json").json()
Insert cell
Insert cell
projection = d3.geoMercator() // just the standard, common, Mercator projection
Insert cell
Insert cell
pathGenerator = d3.geoPath().projection(projection); // to create SVG paths from the points of the GIS features
Insert cell
Insert cell
drawMap = {
let mapLayer = map.append("g").attr("id","countries")
.selectAll("path")
.data(world.features)
.join("path")
.attr("d", pathGenerator)
.attr("id", d => d["id"]);
return mapLayer;
}
Insert cell
<style>
#countries path {fill: #eeeeee; stroke: #ccc}
</style>
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more