Public
Edited
May 12, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
bertin.draw({
params: {
background: "#bde1f0",
projection: d3.geoBertin1953(),
width: width
},
layers: [
{
type: "bubble",
geojson: scomext,
values: "Exportation (valeur)",
k:20,
fillOpacity: 0.7,
leg_x: 780,
leg_y: 410,
leg_fontSize2: 17,
leg_title: `Exportation`,
dorling: true,

},
{
type: "layer",
geojson: bn,
fill: 'lightgrey'
}
]
})
Insert cell
Insert cell
comext = FileAttachment("COMEXTBOIS_2022@3.csv").csv()
Insert cell
countries = FileAttachment("CNTR_LB_2020_4326.geojson").json()
Insert cell
bn = FileAttachment("CNTR_RG_60M_2020_4326.geojson").json()
Insert cell
world
Insert cell
world = FileAttachment("countries.json").json()
Insert cell
Plot.plot({ projection: "equal-earth", marks: [Plot.geo(world)] })
Insert cell
{
const container = yield htl.html`<div style="height: 500px;">`;
const map = L.map(container);
const layer = L.geoJSON(world).addTo(map);
map.fitBounds(layer.getBounds(), {maxZoom: 9});
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
attribution: "© <a href=https://www.openstreetmap.org/copyright>OpenStreetMap</a> contributors"
}).addTo(map);
}
Insert cell
geojson6 = bertin.properties.filter({
geojson: bn,
expression: "NAME_ENGL != 'Antarctica'"
})
Insert cell
{
const container = yield htl.html`<div style="height: 500px;">`;
const map = L.map(container);
const layer = L.geoJSON(geojson6).addTo(map);
map.fitBounds(layer.getBounds(), {maxZoom: 9});
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
attribution: "© <a href=https://www.openstreetmap.org/copyright>OpenStreetMap</a> contributors"
}).addTo(map);
}
Insert cell
bertin = require("bertin@1")
Insert cell
scomext = bertin.merge(
countries,
"CNTR_ID",
comext2,
"tt",
false
);
Insert cell
Insert cell
COMEXTBOIS_2022@3.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
d3 = require("d3@7", "d3-geo-projection@4")
Insert cell
cntr_lb_2020_4326 = FileAttachment("CNTR_LB_2020_4326.geojson").json()
Insert cell
comext2 = {
var temp =[]
for (var element of comext) {
if ( element.Pays != "MYX - Mayotte")
{ element["tt"] = element.Pays.substr(0,2)
temp.push(element)}
}
return(temp)
}

Insert cell
comext2
Insert cell
unique = [...new Set(comext2.map(d=>d.tt))];

Insert cell
tt =comext2.map(d=>d.tt)
Insert cell
{var counts = {};
for (var i = 0; i < tt.length; i++) {
counts[tt[i]] = 1 + (counts[tt[i]] || 0);
}
return(counts)}

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