8000 test adding an option to use country borderlines from a UN geojson dataset for geo subplots by archmoj · Pull Request #7327 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

test adding an option to use country borderlines from a UN geojson dataset for geo subplots #7327

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

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
use un_world from sane-topojson
  • Loading branch information
archmoj committed Dec 17, 2024
commit 8b5de735e2e99753da36dfa4e11d2c46b962e2c7
10 changes: 9 additions & 1 deletion src/lib/topojson_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ topojsonUtils.getTopojsonName = function(geoLayout) {
};

topojsonUtils.getTopojsonPath = function(topojsonURL, topojsonName) {
return topojsonURL + topojsonName + '.json';
var path = topojsonURL;

if(topojsonName.startsWith('un_')) {
path += 'un';
} else {
path += topojsonName;
}

return path + '.json';
};

topojsonUtils.getTopojsonFeatures = function(trace, topojson) {
Expand Down
15 changes: 9 additions & 6 deletions src/plots/geo/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,17 @@ exports.lataxisSpan = {
'*': 180
};

var world = {
lonaxisRange: [-180, 180],
lataxisRange: [-90, 90],
projType: 'equirectangular',
projRotate: [0, 0, 0]
};

// defaults for each scope
exports.scopeDefaults = {
world: {
lonaxisRange: [-180, 180],
lataxisRange: [-90, 90],
projType: 'equirectangular',
projRotate: [0, 0, 0]
},
un: world,
world: world,
usa: {
lonaxisRange: [-180, -50],
lataxisRange: [15, 80],
Expand Down
2 changes: 1 addition & 1 deletion src/plots/geo/layout_attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ var attrs = module.exports = overrideAll({
scope: {
valType: 'enumerated',
values: sortObjectKeys(constants.scopeDefaults),
dflt: 'world',
dflt: 'un',
description: 'Set the scope of the map.'
},
projection: {
Expand Down
3 changes: 2 additions & 1 deletion test/plot-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2540,7 +2540,7 @@
"role": "object",
"scope": {
"description": "Set the scope of the map.",
"dflt": "world",
"dflt": "un",
"editType": "plot",
"valType": "enumerated",
"values": [
Expand All @@ -2549,6 +2549,7 @@
"europe",
"north america",
"south america",
"un",
"usa",
"world"
]
Expand Down
0