feat(layers): add shipwrecks layer (EMODnet + Wikidata)

A new Events layer maps shipwrecks with a card per wreck:
- EMODnet Human Activities heritage shipwrecks (about 6,500 in European
  waters, CC BY 4.0), skipping rows taken from wrecksite.eu.
- Wikidata shipwrecks with a Wikipedia article plus sinking events
  (CC0); an event folds into its ship for the date and death toll.
- A same-origin /api/shipwrecks proxy refreshes once a day and serves
  the last snapshot as stale for up to a week.

Markers are a boat icon coloured by era and sized by deaths; four era
chips filter the layer. The card follows the air-accidents layout
(deaths first). Text that names people is dropped; victims appear as
a count only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Itallo BrandãoandClaude Opus 5.5 committed 2026-11-05 04:42:59 -03:00
1 parent 7d8b80db0a
commit dcd0f2cccd
41 files changed
+2168 -73

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
/** Era chips, oldest first; a wreck with no known year sits in its own chip. */
export const SHIPWRECK_ERAS = Object.freeze([
'before-1900',
'1900-1945',
'after-1945',
'undated',
]);
/**
* The era a wreck belongs to. Ancient wrecks dated only by period
* ("Roman Imperial", "C1st AD") count as before 1900.
* @param {{year?: number|null, ancient?: boolean}} record
* @returns {string}
*/
export function eraOf(record) {
const year = Number.isInteger(record?.year) ? record.year : null;
if (year === null) return record?.ancient ? 'before-1900' : 'undated';
if (year < 1900) return 'before-1900';
if (year <= 1945) return '1900-1945';
return 'after-1945';
}
/**
* Normalize a requested set of eras; unknown names are ignored and an empty
* or missing request keeps the current set.
* @param {unknown} value Array of era ids.
* @param {Set<string>} current
* @returns {Set<string>}
*/
export function normalizeEras(value, current) {
if (!Array.isArray(value)) return new Set(current);
return new Set(value.filter((era) => SHIPWRECK_ERAS.includes(era)));
}