Skip to content

chore: Update topojson deps - #8188

Open
camdecoster wants to merge 10 commits into
mainfrom
cam/7922/update-topojson-deps
Open

camdecoster wants to merge 10 commits into
mainfrom
cam/7922/update-topojson-deps

Conversation

@camdecoster

@camdecoster camdecoster commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

Update the dependencies in the topojson subproject and fix a few bugs.

Closes #7922.

Changes

  • Update dependencies (this addresses a security vulnerability in an old Mapshaper dependency)
  • Refactor the scripts to be clearer
  • Combine polygons with same ISO code
  • Improve stitching near antimeridian
  • Update resulting maps

Screenshots

Before After
image image

Testing

  • Review the CI results
  • Be on main
  • Open Plotly devtools and paste the following snippet into browser devtools:
// Orange is the choropleth fill and green is land without fill
const panels = [
    { title: 'PRT, ESP: Azores, Madeira, Canaries', locations: ['PRT', 'ESP'], lon: [-32, 4], lat: [26, 45] },
    { title: 'ECU: Galápagos', locations: ['ECU'], lon: [-92.5, -75], lat: [-5.5, 2] },
    { title: 'PSE: West Bank', locations: ['PSE'], lon: [34, 35.8], lat: [31.1, 32.7] },
    { title: 'MUS: Diego Garcia (Chagos)', locations: ['MUS'], lon: [72.3, 72.55], lat: [-7.48, -7.22] },
    { title: 'BES: Saba, Sint Eustatius', locations: ['BES'], lon: [-63.35, -62.85], lat: [17.4, 17.7] },
    { title: 'FJI: eastern tip of Vanua Levu', locations: ['FJI'], lon: [179.6, 180.4], lat: [-16.5, -15.9], rotate: true },
    { title: 'FJI, scope oceania: Taveuni at 180°', locations: ['FJI'], lon: [179.75, 180.25], lat: [-17.05, -16.7], rotate: true, scope: 'oceania' }
];

const data = [];
const layout = { width: 1400, height: 750, margin: { t: 40, b: 10, l: 10, r: 10 }, annotations: [] };
panels.forEach(({ title, locations, lon, lat, rotate, scope = 'world' }, i) => {
    const geo = i ? `geo${i + 1}` : 'geo';
    const [col, row] = [i % 4, Math.floor(i / 4)];
    const x = [col * 0.25 + 0.01, col * 0.25 + 0.24];
    const y = row ? [0, 0.43] : [0.52, 0.95];
    data.push({ type: 'choropleth', geo, locations, z: locations.map(() => 1), showscale: false, colorscale: [[0, '#ff7f0e'], [1, '#ff7f0e']] });
    layout[geo] = {
        domain: { x, y },
        scope,
        resolution: 50,
        fitbounds: false,
        projection: { type: 'mercator', ...(rotate && { rotation: { lon: 180 } }) },
        lonaxis: { range: lon },
        lataxis: { range: lat },
        showland: true,
        landcolor: '#b7e4a1',
        showocean: true,
        oceancolor: '#cfe8ff'
    };
    layout.annotations.push({ text: title, x: (x[0] + x[1]) / 2, y: y[1], xref: 'paper', yref: 'paper', yanchor: 'bottom', showarrow: false });
});

Plotly.newPlot(Tabs.fresh(), data, layout);
  • Note that the other polygons with the same ISO codes aren't being filled in for the choropleths and Fiji has stitching issues
  • Switch to this branch
  • Run the snippet again
  • Note that the polygons are filled in and there aren't any Fiji stitching issues

Notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CHORE]: Update dependencies in topojson/, stackgl_modules/

1 participant