Skip to content

Commit 6efc8fe

Browse files
authored
Merge pull request #7393 from plotly/cam/7334/switch-geodata-providers
feat: Switch geodata providers
2 parents 021289c + 0d6b5b7 commit 6efc8fe

File tree

98 files changed

+2113
-65
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+2113
-65
lines changed

.circleci/config.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,11 +483,32 @@ jobs:
483483
name: Bundle bundle-stackgl/index.js
484484
command: cd stackgl_modules && cp index.js INDEX.js && npm run bundle-stackgl
485485
- run:
486-
name: Test stackgl_modules/index.js diff - If failed please remember this file in auto generated and you should not modify it directly until a dependeny change. To suggest changes please submit pull request to the relevant dependency.
486+
name: Test stackgl_modules/index.js diff - If failed please remember this file in auto generated and you should not modify it directly until a dependency change. To suggest changes please submit pull request to the relevant dependency.
487487
command: diff --unified --color stackgl_modules/INDEX.js stackgl_modules/index.js
488488
- store_artifacts:
489489
path: stackgl_modules/index.js
490490
destination: stackgl_modules/index.js
491+
492+
test-topojson-build:
493+
docker:
494+
- image: cimg/node:18.20.4
495+
working_directory: ~/plotly.js
496+
steps:
497+
- checkout
498+
- run:
499+
name: Set up build environment
500+
command: cd topojson && npm ci
501+
- run:
502+
name: Build topojson
503+
command: cd topojson && mv dist dist_backup && npm run build
504+
- run:
505+
name: Compare existing files with newly built files. Any difference is a failure. A failure might mean that the source data changed.
506+
command: diff -qr topojson/dist topojson/dist_backup
507+
- run:
508+
name: Compress artifacts
509+
command: tar -cvzf topojson.tar topojson/dist
510+
- store_artifacts:
511+
path: topojson.tar
491512

492513
workflows:
493514
version: 2
@@ -560,3 +581,5 @@ workflows:
560581
- publish-dist-node-v22
561582

562583
- test-stackgl-bundle
584+
585+
- test-topojson-build

devtools/test_dashboard/devtools.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ var Tabs = {
1717
Plotly.setPlotConfig({
1818

1919
// use local topojson files
20-
topojsonURL: '../../node_modules/sane-topojson/dist/',
21-
20+
topojsonURL: "../../topojson/dist",
2221
// register mapbox access token
2322
// run `npm run preset` if you haven't yet
2423
mapboxAccessToken: credentials.MAPBOX_ACCESS_TOKEN,
@@ -268,4 +267,3 @@ function handleOnLoad() {
268267
Tabs.setPlotConfig();
269268
plotFromHash();
270269
}
271-

draftlogs/7393_change.md

Lines changed: 1 addition & 0 deletions

package-lock.json

Lines changed: 15 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@
171171
"raw-loader": "^4.0.2",
172172
"read-last-lines": "^1.8.0",
173173
"run-series": "^1.1.9",
174-
"sane-topojson": "^4.0.0",
175174
"sass": "^1.78.0",
176175
"stream-browserify": "^3.0.0",
177176
"style-loader": "^4.0.0",

src/assets/geo_assets.js

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,28 @@
11
'use strict';
22

3-
var saneTopojson = require('sane-topojson');
3+
// TODO: Remove comments from Antarctica, Oceania during new maps release PR
4+
const topojson = {
5+
africa_110m: require('../../dist/topojson/africa_110m.json'),
6+
// antarctica_110m: require('../../dist/topojson/antarctica_110m.json'),
7+
asia_110m: require('../../dist/topojson/asia_110m.json'),
8+
europe_110m: require('../../dist/topojson/europe_110m.json'),
9+
'north-america_110m': require('../../dist/topojson/north-america_110m.json'),
10+
// oceania_110m: require('../../dist/topojson/oceania_110m.json'),
11+
'south-america_110m': require('../../dist/topojson/south-america_110m.json'),
12+
usa_110m: require('../../dist/topojson/usa_110m.json'),
13+
world_110m: require('../../dist/topojson/world_110m.json'),
14+
africa_50m: require('../../dist/topojson/africa_50m.json'),
15+
// antarctica_50m: require('../../dist/topojson/antarctica_50m.json'),
16+
asia_50m: require('../../dist/topojson/asia_50m.json'),
17+
europe_50m: require('../../dist/topojson/europe_50m.json'),
18+
'north-america_50m': require('../../dist/topojson/north-america_50m.json'),
19+
// oceania_50m: require('../../dist/topojson/oceania_50m.json'),
20+
'south-america_50m': require('../../dist/topojson/south-america_50m.json'),
21+
usa_50m: require('../../dist/topojson/usa_50m.json'),
22+
world_50m: require('../../dist/topojson/world_50m.json'),
23+
}
424

5-
6-
exports.version = require('../version').version;
7-
8-
exports.topojson = saneTopojson;
25+
module.exports = {
26+
topojson,
27+
version: require('../version').version
28+
}

src/lib/topojson_utils.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ topojsonUtils.getTopojsonName = function(geoLayout) {
1313
};
1414

1515
topojsonUtils.getTopojsonPath = function(topojsonURL, topojsonName) {
16-
return topojsonURL + topojsonName + '.json';
16+
topojsonURL += topojsonURL.endsWith('/') ? '' : '/';
17+
18+
return `${topojsonURL}${topojsonName}.json`;
1719
};
1820

1921
topojsonUtils.getTopojsonFeatures = function(trace, topojson) {

src/plots/geo/constants.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,19 @@ exports.scopeDefaults = {
185185
lataxisRange: [-60, 15],
186186
projType: 'mercator',
187187
projRotate: [0, 0, 0]
188-
}
188+
},
189+
antarctica: {
190+
lonaxisRange: [-180, 180],
191+
lataxisRange: [-90, -60],
192+
projType: 'equirectangular',
193+
projRotate: [0, 0, 0]
194+
},
195+
oceania: {
196+
lonaxisRange: [-180, 180],
197+
lataxisRange: [-50, 25],
198+
projType: 'equirectangular',
199+
projRotate: [0, 0, 0]
200+
},
189201
};
190202

191203
// angular pad to avoid rounding error around clip angles

tasks/cdn_publish.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@ for path in `ls $dist/plotly*`; do
2929
done
3030

3131
# copy topojson files over to the sync folder
32-
cp $dist/topojson/* $sync
32+
# NOTE: Temporarily adding the suffix '_un' to avoid overwriting the old topojson
33+
# which some old plots might depend on
34+
for filepath in $dist/topojson/*.json; do
35+
f=${filepath##*/}
36+
f=${f%.*}
37+
cp $filepath "$sync/${f%.*}_un.json"
38+
done
3339

3440
# list folder and files
3541
echo $sync

tasks/preprocess.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ function writeLibFiles(obj) {
7373
}
7474
}
7575

76-
// copy topojson files from sane-topojson to dist/
7776
function copyTopojsonFiles() {
7877
fs.copy(
7978
constants.pathToTopojsonSrc,

0 commit comments

Comments
 (0)