The interactive maps fetch the web-sized boundaries
Seven consumers switch to the -web copies exp-shepherd built (5410842a: every feature and island kept, about
a fifth of the bytes): useCountryOutline, useMapLayers, regions RegionCountryMap, research-dashboard
DashboardMapPanel, cities-internet connectivity-map (world + India states), gospel resources-map (world +
India provinces) and my-upg-100-list (world + UPG-100's India partition; China unchanged). generate-tree
stages the three -web files beside the full ones. Posters, print and every build-time point-in-polygon keep
the full files, as REPORT-WEB-BOUNDARIES.md requires: no runtime code tests membership on these.
This commit is contained in:
parent
9a955f8f20
commit
f728831d77
8 changed files with 19 additions and 10 deletions
|
|
@ -1519,6 +1519,12 @@ function main() {
|
|||
// for maps that colour every state. The curated file above is UPG-100's 34-unit partition.
|
||||
[resolve(__dirname, '..', 'data', 'boundaries', 'gb-IND-ADM1-full.geojson'), 'gb-IND-ADM1-full.geojson'],
|
||||
[resolve(__dirname, '..', 'data', 'boundaries', 'gb-IND-ADM1-full.meta.json'), 'gb-IND-ADM1-full.meta.json'],
|
||||
// WEB copies (library/scripts/boundaries/build-web-boundaries.mjs): every feature and island kept, about
|
||||
// a fifth of the bytes. The interactive maps fetch these; posters, print and build-time point-in-polygon
|
||||
// keep the full files above (REPORT-WEB-BOUNDARIES.md).
|
||||
[join(dataDir, 'adm0', 'world-adm0-web.geojson'), 'world-adm0-web.geojson'],
|
||||
[join(dataDir, 'gb-IND-ADM1-web.geojson'), 'gb-IND-ADM1-web.geojson'],
|
||||
[resolve(__dirname, '..', 'data', 'boundaries', 'gb-IND-ADM1-full-web.geojson'), 'gb-IND-ADM1-full-web.geojson'],
|
||||
]) if (existsSync(from)) cpSync(from, join(bDir, to))
|
||||
console.log('[generate-tree] gathered boundary geojson')
|
||||
|
||||
|
|
@ -1579,6 +1585,9 @@ function main() {
|
|||
'boundaries/gb-CHN-ADM1.geojson',
|
||||
'boundaries/gb-IND-ADM1-full.geojson', // all 36 states (Cities with Internet's NFHS layer)
|
||||
'boundaries/gb-IND-ADM1-full.meta.json', // its source and licence, served beside it
|
||||
'boundaries/world-adm0-web.geojson', // the web copies the interactive maps fetch
|
||||
'boundaries/gb-IND-ADM1-web.geojson',
|
||||
'boundaries/gb-IND-ADM1-full-web.geojson',
|
||||
// people-groups — all-people-groups.vue (the slim JSON only; NOT the 16 MB CSV,
|
||||
// which no element fetches and which dropin.exclude already withholds).
|
||||
'people-groups/people-groups-slim.json',
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ export function useCountryOutline(getMap, opts = {}) {
|
|||
// Add EMPTY first, then setData after the fetch, so addLayer below stays SYNCHRONOUS and
|
||||
// the outline keeps its place in the layer order.
|
||||
m.addSource(SOURCE_ID, { type: 'geojson', data: { type: 'FeatureCollection', features: [] } })
|
||||
fetch(`${resolveAssetsBase(null)}/boundaries/world-adm0.geojson`)
|
||||
fetch(`${resolveAssetsBase(null)}/boundaries/world-adm0-web.geojson`)
|
||||
.then((r) => r.json())
|
||||
.then((gj) => {
|
||||
// The tileset names the ISO field iso_3166_1_alpha_3; the geojson names it iso3.
|
||||
|
|
|
|||
|
|
@ -434,7 +434,7 @@ export function useMapLayers(options = {}) {
|
|||
// EMPTY first so the addLayer below stays synchronous and keeps its z-order slot
|
||||
// (regions → shadow → pins → hitbox); setData once the fetch lands.
|
||||
map.addSource('regions', { type: 'geojson', data: { type: 'FeatureCollection', features: [] } });
|
||||
fetch(`${resolveAssetsBase(null)}/boundaries/world-adm0.geojson`)
|
||||
fetch(`${resolveAssetsBase(null)}/boundaries/world-adm0-web.geojson`)
|
||||
.then((r) => r.json())
|
||||
.then((gj) => {
|
||||
// Tileset field is iso_3166_1_alpha_3; the geojson's is iso3. Normalise ONCE
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ async function load() {
|
|||
// review caught it as "India seems to have no internet coverage". The fix was a
|
||||
// second file, world-adm0-plus.geojson; that file is gone and India is fetched
|
||||
// at ADM0 like every other country (data/source-boundaries.mjs).
|
||||
fetch(`${assetsBase.value}/boundaries/world-adm0.geojson`).then((r) => r.json()),
|
||||
fetch(`${assetsBase.value}/boundaries/world-adm0-web.geojson`).then((r) => r.json()),
|
||||
])
|
||||
rows.value = data.countries || []
|
||||
return adm0
|
||||
|
|
@ -304,7 +304,7 @@ async function loadAdm1() {
|
|||
fetch(`${assetsBase.value}/tables/internet-by-adm1.json`).then((r) => { if (!r.ok) throw new Error('internet-by-adm1 ' + r.status); return r.json() }),
|
||||
// All 36 states (data/boundaries/gb-IND-ADM1-full.geojson). NOT gb-IND-ADM1.geojson: that one is
|
||||
// UPG-100's partition, curated to 34 units, and it left Mizoram and Nagaland with no geometry.
|
||||
fetch(`${assetsBase.value}/boundaries/gb-IND-ADM1-full.geojson`).then((r) => { if (!r.ok) throw new Error('gb-IND-ADM1-full ' + r.status); return r.json() }),
|
||||
fetch(`${assetsBase.value}/boundaries/gb-IND-ADM1-full-web.geojson`).then((r) => { if (!r.ok) throw new Error('gb-IND-ADM1-full ' + r.status); return r.json() }),
|
||||
])
|
||||
const byArea = {}
|
||||
for (const r of table.rows || []) {
|
||||
|
|
|
|||
|
|
@ -1114,7 +1114,7 @@ async function load() {
|
|||
// review caught it as "India seems to have no internet coverage". The fix was a
|
||||
// second file, world-adm0-plus.geojson; that file is gone and India is fetched
|
||||
// at ADM0 like every other country (data/source-boundaries.mjs).
|
||||
fetch(`${assetsBase.value}/boundaries/world-adm0.geojson`).then((r) => r.json()),
|
||||
fetch(`${assetsBase.value}/boundaries/world-adm0-web.geojson`).then((r) => r.json()),
|
||||
// 650KB and it is the point of the map, so it loads with the boundaries rather
|
||||
// than behind a tap. URLs are normalised into `codes` by ISO 639-3, so the 12,379
|
||||
// pins carry a code rather than 12,379 copies of the same jesusfilm.org link.
|
||||
|
|
@ -1270,7 +1270,7 @@ async function ensureProvinceTable() {
|
|||
return provinceRows.value
|
||||
}
|
||||
|
||||
const PROVINCE_FILE = { IND: 'gb-IND-ADM1-full.geojson', CHN: 'gb-CHN-ADM1.geojson' }
|
||||
const PROVINCE_FILE = { IND: 'gb-IND-ADM1-full-web.geojson', CHN: 'gb-CHN-ADM1.geojson' }
|
||||
|
||||
async function ensureProvinces(iso3) {
|
||||
const map = mapRef.value
|
||||
|
|
|
|||
|
|
@ -2210,10 +2210,10 @@ onMounted(async () => {
|
|||
// and it overlapped nothing: a promise created after an await starts only once that await
|
||||
// resolves, so the code read as parallel and behaved strictly serially.
|
||||
const boundaryPromises = {
|
||||
adm0: getJSON('world-adm0.geojson'),
|
||||
adm0: getJSON('world-adm0-web.geojson'),
|
||||
adm1Chn: getJSON('gb-CHN-ADM1.geojson'),
|
||||
// 1,628 KB, and only the India pg_slugs zones need it.
|
||||
adm1Ind: getJSON('gb-IND-ADM1.geojson'),
|
||||
adm1Ind: getJSON('gb-IND-ADM1-web.geojson'),
|
||||
}
|
||||
|
||||
// ── live records WITH rop1 + population (full record; LESSON L3 / slice 04u) ──
|
||||
|
|
|
|||
|
|
@ -274,7 +274,7 @@ function addLayers() {
|
|||
// Add EMPTY first, then setData after the fetch: the addLayer calls below must run
|
||||
// SYNCHRONOUSLY to keep these fills beneath the pins (layer order is insertion order).
|
||||
m.addSource(SRC_COUNTRIES, { type: 'geojson', data: { type: 'FeatureCollection', features: [] } })
|
||||
fetch(`${resolveAssetsBase(profileConfig?.value)}/boundaries/world-adm0.geojson`)
|
||||
fetch(`${resolveAssetsBase(profileConfig?.value)}/boundaries/world-adm0-web.geojson`)
|
||||
.then((r) => r.json())
|
||||
.then((gj) => {
|
||||
for (const f of gj.features || []) {
|
||||
|
|
|
|||
|
|
@ -834,7 +834,7 @@ function addLayers() {
|
|||
// keep this layer underneath the pins (layer order is insertion order). An awaited fetch
|
||||
// here would put the choropleth on TOP of every bubble.
|
||||
m.addSource('rd-countries', { type: 'geojson', data: { type: 'FeatureCollection', features: [] } })
|
||||
fetch(`${resolveAssetsBase(profileConfig.value)}/boundaries/world-adm0.geojson`)
|
||||
fetch(`${resolveAssetsBase(profileConfig.value)}/boundaries/world-adm0-web.geojson`)
|
||||
.then((r) => r.json())
|
||||
.then((gj) => {
|
||||
for (const f of gj.features || []) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue