Public
Edited
Jan 18, 2024
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
badge_labels = get_labels(["Q17437796", "Q17437798"], lang).then((d) =>
d.objects()
)
Insert cell
labels_map = new Map(
badge_labels.map(({ label, qid }) => [label + " (" + qid + ")", qid])
)
Insert cell
import { get_labels } from "@pac02/what-kind-of-articles-have-you-created"
Insert cell
Insert cell
query = `SELECT ?name ?url ?coord
WHERE {
?url schema:isPartOf <https://${wikipedia}/>;
wikibase:badge wd:${badge};
schema:about ?item;
schema:name ?name.
?item wdt:P625 ?coord.
}`
Insert cell
data = fetch(
`https://query.wikidata.org/sparql?query=${encodeURIComponent(query)}`,
{ headers: { accept: "application/sparql-results+json" } }
).then((response) => response.json())
Insert cell
array = data.results.bindings.map((d) => ({
url: d.url.value,
name: d.name.value,
coord: d.coord.value
}))
Insert cell
df = aq.from(array)
Insert cell
geoarray = geo.coords2geo(array, { coords: "coord", reverse: true })
Insert cell
df.dedupe("url").numRows()
Insert cell
Insert cell
geo = require("geotoolbox@2")
Insert cell
viz = require("geoviz@0.4.4")
Insert cell
d3 = require("d3@7", "d3-geo-projection@4")
Insert cell
Insert cell
Insert cell
import { wikipedias } from "@pac02/user-level-gender-statistics-for-wikipedia"
Insert cell
Insert cell
get_default = () => {
const params = new URL(document.URL).searchParams;
const defaults = {
badge: "Q17437796",
wikipedia: "fr.wikipedia.org",
lang: "en"
};
if (params.has("badge")) {
defaults.badge = params.get("badge");
}
if (params.has("wikipedia")) {
defaults.wikipedia = params.get("wikipedia");
}
if (params.has("lang")) {
defaults.lang = params.get("lang");
}
return defaults;
}
Insert cell
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