Skip to content

Use sane-topojson v3 #3874

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/topojson/africa_110m.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/topojson/africa_50m.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/topojson/asia_110m.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/topojson/asia_50m.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/topojson/europe_110m.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/topojson/europe_50m.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/topojson/north-america_110m.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/topojson/north-america_50m.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/topojson/south-america_110m.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/topojson/south-america_50m.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/topojson/usa_110m.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/topojson/usa_50m.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/topojson/world_110m.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/topojson/world_50m.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
"regl-splom": "^1.0.6",
"right-now": "^1.0.0",
"robust-orientation": "^1.1.3",
"sane-topojson": "^2.0.0",
"sane-topojson": "^3.0.1",
"strongly-connected-components": "^1.0.1",
"superscript-text": "^1.0.0",
"svg-path-sdf": "^1.1.3",
Expand Down
9 changes: 2 additions & 7 deletions src/lib/geo_location_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,16 @@ function locationToFeature(locationmode, location, features) {

if(locationId) {
if(locationmode === 'USA-states') {
// Filter out features south of the equator
// Filter out features out in USA
//
// This is important as the Natural Earth files
// include state/provinces from USA, Canada, Australia and Brazil
// which have some overlay in their two-letter ids. For example,
// 'WA' is used for both Washington state and Western Australia.
// As subunits from USA and Canada never conflict, filtering out features
// south of the equator suffices to fix https://github.com/plotly/plotly.js/issues/3779
//
// A better fix would have us add a "governing unit" properties in subunit features
// in the `sane-topojson` package to avoid conflicts.
features2 = [];
for(i = 0; i < features.length; i++) {
f = features[i];
if(f.properties && f.properties.ct && f.properties.ct[1] > 0) {
if(f.properties && f.properties.gu && f.properties.gu === 'USA') {
features2.push(f);
}
}
Expand Down
17 changes: 14 additions & 3 deletions tasks/util/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,20 @@ var pathToImageTest = path.join(pathToRoot, 'test/image');
var pathToDist = path.join(pathToRoot, 'dist/');
var pathToBuild = path.join(pathToRoot, 'build/');

var pathToTopojsonSrc = path.join(
path.dirname(require.resolve('sane-topojson')), 'dist/'
);
var pathToTopojsonSrc;
try {
pathToTopojsonSrc = path.join(path.dirname(require.resolve('sane-topojson')), 'dist/');
} catch(e) {
console.log([
'',
'WARN: Cannot resolve path to *sane-topojson* package.',
' This can happen when one `npm link sane-topojson`',
' and runs a command in a Docker container.',
' There is nothing to worry, if you see this warning while running',
' `npm run test-image`, `npm run test-export` or `npm run baseline` ;)',
''
].join('\n'));
}

var partialBundleNames = [
'basic', 'cartesian', 'geo', 'gl3d', 'gl2d', 'mapbox', 'finance'
Expand Down
Binary file removed test/image/baselines/geo_canadian-cites.png
Binary file not shown.
Binary file added test/image/baselines/geo_canadian-cities.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/geo_choropleth-text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/geo_country-names.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/geo_custom-colorscale.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/geo_europe-bubbles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/geo_first.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/geo_orthographic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/geo_point-selection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/geo_scattergeo-out-of-usa.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/geo_second.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/geo_stereographic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.