8000 no predefined stamen styles in map subplots by archmoj · Pull Request #7085 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

no predefined stamen styles in map subplots #7085

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 2 commits into from
Aug 12, 2024
Merged
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
Next Next commit
no predefined stamen styles in map
 - the user need to provide their API key when using stamen styles
  • Loading branch information
archmoj committed Aug 12, 2024
commit 7744ef4cc5d95acbbf82499bb9f20f7988d913d2
77 changes: 0 additions & 77 deletions src/plots/map/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,6 @@ var sortObjectKeys = require('../../lib/sort_object_keys');

var OSM = '© <a target="_blank" href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors';

var stamenTerrainOrToner = [
'Map tiles by <a target="_blank" href="https://stamen.com">Stamen Design</a>',
'under <a target="_blank" href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>',
'|',
'Data by <a target="_blank" href="https://openstreetmap.org">OpenStreetMap</a> contributors',
'under <a target="_blank" href="https://www.openstreetmap.org/copyright">ODbL</a>'
].join(' ');

var stamenWaterColor = [
'Map tiles by <a target="_blank" href="https://stamen.com">Stamen Design</a>',
'under <a target="_blank" href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>',
'|',
'Data by <a target="_blank" href="https://openstreetmap.org">OpenStreetMap</a> contributors',
'under <a target="_blank" href="https://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>'
].join(' ');


var cartoPositron = 'https://basemaps.cartocdn.com/gl/positron-gl-style/style.json';
var cartoDarkmatter = 'https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json';
var cartoVoyager = 'https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json';
Expand Down Expand Up @@ -173,66 +156,6 @@ var stylesMap = {
'carto-positron-nolabels': cartoPositronNoLabels,
'carto-darkmatter-nolabels': cartoDarkmatterNoLabels,
'carto-voyager-nolabels': cartoVoyagerNoLabels,
'stamen-terrain': {
id: 'stamen-terrain',
version: 8,
sources: {
'plotly-stamen-terrain': {
type: 'raster',
attribution: stamenTerrainOrToner,
tiles: ['https://tiles.stadiamaps.com/tiles/stamen_terrain/{z}/{x}/{y}.png'],
tileSize: 256
}
},
layers: [{
id: 'plotly-stamen-terrain',
type: 'raster',
source: 'plotly-stamen-terrain',
minzoom: 0,
maxzoom: 22
}],
glyphs: 'https://fonts.openmaptiles.org/{fontstack}/{range}.pbf'
},
'stamen-toner': {
id: 'stamen-toner',
version: 8,
sources: {
'plotly-stamen-toner': {
type: 'raster',
attribution: stamenTerrainOrToner,
tiles: ['https://tiles.stadiamaps.com/tiles/stamen_toner/{z}/{x}/{y}.png'],
tileSize: 256
}
},
layers: [{
id: 'plotly-stamen-toner',
type: 'raster',
source: 'plotly-stamen-toner',
minzoom: 0,
maxzoom: 22
}],
glyphs: 'https://fonts.openmaptiles.org/{fontstack}/{range}.pbf'
},
'stamen-watercolor': {
id: 'stamen-watercolor',
version: 8,
sources: {
'plotly-stamen-watercolor': {
type: 'raster',
attribution: stamenWaterColor,
tiles: ['https://tiles.stadiamaps.com/tiles/stamen_watercolor/{z}/{x}/{y}.jpg'],
tileSize: 256
}
},
layers: [{
id: 'plotly-stamen-watercolor',
type: 'raster',
source: 'plotly-stamen-watercolor',
minzoom: 0,
maxzoom: 22
}],
glyphs: 'https://fonts.openmaptiles.org/{fontstack}/{range}.pbf'
}
};

var styleValuesMap = sortObjectKeys(stylesMap);
Expand Down
70 changes: 67 additions & 3 deletions test/image/mocks/map_stamen-style.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,79 @@
},
"map": {
"domain": {"row": 0, "column": 0},
"style": "stamen-terrain"
"style": {
"version": 8,
"sources": {
"plotly-stamen-terrain": {
"type": "raster",
"tiles": ["https://tiles.stadiamaps.com/tiles/stamen_terrain/{z}/{x}/{y}.png"],
"tileSize": 256,
"attribution": "Map tiles by <a target='_blank' href='https://stamen.com'>Stamen Design</a> under <a target='_blank' href='https://creativecommons.org/licenses/by/3.0'>CC BY 3.0</a> | Data by <a target='_blank' href='https://openstreetmap.org'>OpenStreetMap</a> contributors under <a target='_blank' href='https://www.openstreetmap.org/copyright'>ODbL</a>"
}
},
"layers": [{
"id": "plotly-stamen-terrain",
"type": "raster",
"source": "plotly-stamen-terrain",
"minzoom": 0,
"maxzoom": 22
}],
"glyphs": "https://fonts.openmaptiles.org/{fontstack}/{range}.pbf"
}
},
"map2": {
"domain": {"row": 0, "column": 1},
"style": "stamen-toner"
"style": {
"id": "stamen-toner",
"version": 8,
"sources": {
"plotly-stamen-toner": {
"type": "raster",
"tiles": [
"https://tiles.stadiamaps.com/tiles/stamen_toner/{z}/{x}/{y}.png"
],
"tileSize": 256,
"attribution": "Map tiles by <a target='_blank' href='https://stamen.com'>Stamen Design</a> under <a target='_blank' href='https://creativecommons.org/licenses/by/3.0'>CC BY 3.0</a> | Data by <a target='_blank' href='https://openstreetmap.org'>OpenStreetMap</a> contributors under <a target='_blank' href='https://www.openstreetmap.org/copyright'>ODbL</a>"
}
},
"layers": [
{
"id": "plotly-stamen-toner",
"type": "raster",
"source": "plotly-stamen-toner",
"minzoom": 0,
"maxzoom": 22
}
],
"glyphs": "https://fonts.openmaptiles.org/{fontstack}/{range}.pbf"
}
},
"map3": {
"domain": {"row": 0, "column": 2},
"style": "stamen-watercolor"
"style": {
"id": "stamen-watercolor",
"version": 8,
"sources": {
"plotly-stamen-watercolor": {
"type": "raster",
"tiles": [
"https://tiles.stadiamaps.com/tiles/stamen_watercolor/{z}/{x}/{y}.jpg"
],
"tileSize": 256,
"attribution": "Map tiles by <a target='_blank' href='https://stamen.com'>Stamen Design</a> under <a target='_blank' href='https://creativecommons.org/licenses/by/3.0'>CC BY 3.0</a> | Data by <a target='_blank' href='https://openstreetmap.org'>OpenStreetMap</a> contributors under <a target='_blank' href='https://creativecommons.org/licenses/by-sa/3.0'>CC BY SA</a>"
}
},
"layers": [
{
"id": "plotly-stamen-watercolor",
"type": "raster",
"source": "plotly-stamen-watercolor",
"minzoom": 0,
"maxzoom": 22
}
],
"glyphs": "https://fonts.openmaptiles.org/{fontstack}/{range}.pbf"
}
}
}
}
36 changes: 1 addition & 35 deletions test/jasmine/tests/map_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1233,40 +1233,6 @@ describe('map plots', function() {
.then(done, done.fail);
});

['stamen-terrain', 'stamen-toner'].forEach(function(style) {
it('@noCI @gl should be displayed for style "' + style + '"', function(done) {
Plotly.newPlot(gd, [{type: 'scattermap'}], {map: {style: style}})
.then(function() {
var s = d3SelectAll('.maplibregl-ctrl-attrib');
expect(s.size()).toBe(1);
expect(s.text()).toEqual('Map tiles by Stamen Design under CC BY 3.0 | Data by OpenStreetMap contributors under ODbL');
assertLinks(s, [
'https://stamen.com/',
'https://creativecommons.org/licenses/by/3.0',
'https://openstreetmap.org/',
'https://www.openstreetmap.org/copyright'
]);
})
.then(done, done.fail);
});
});

it('@noCI @gl should be displayed for style "stamen-watercolor"', function(done) {
Plotly.newPlot(gd, [{type: 'scattermap'}], {map: {style: 'stamen-watercolor'}})
.then(function() {
var s = d3SelectAll('.maplibregl-ctrl-attrib');
expect(s.size()).toBe(1);
expect(s.text()).toEqual('Map tiles by Stamen Design under CC BY 3.0 | Data by OpenStreetMap contributors under CC BY SA');
assertLinks(s, [
'https://stamen.com/',
'https://creativecommons.org/licenses/by/3.0',
'https://openstreetmap.org/',
'https://creativecommons.org/licenses/by-sa/3.0'
]);
})
.then(done, done.fail);
});

it('@gl should be displayed for style "open-street-map"', function(done) {
Plotly.newPlot(gd, [{type: 'scattermap'}], {map: {style: 'open-street-map'}})
.then(function() {
Expand Down Expand Up @@ -1482,7 +1448,7 @@ describe('map react', function() {
}

var firstLink = 'https://a.tile.openstreetmap.org/{z}/{x}/{y}.png';
var secondLink = 'https://a.tile.stamen.com/watercolor/{z}/{x}/{y}.jpg';
var secondLink = 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{x}/{y}.png';

var fig = {
data: [
Expand Down
5 changes: 1 addition & 4 deletions test/plot-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4237,7 +4237,7 @@
},
"role": "object",
"style": {
"description": "Defines the map layers that are rendered by default below the trace layers defined in `data`, which are themselves by default rendered below the layers defined in `layout.map.layers`. These layers can be defined either explicitly as a Map Style object which can contain multiple layer definitions that load data from any public or private Tile Map Service (TMS or XYZ) or Web Map Service (WMS) or implicitly by using one of the built-in style objects which use WMSes or by using a custom style URL Map Style objects are of the form described in the MapLibre GL JS documentation available at https://maplibre.org/maplibre-style-spec/ The built-in plotly.js styles objects are: basic, carto-darkmatter, carto-darkmatter-nolabels, carto-positron, carto-positron-nolabels, carto-voyager, carto-voyager-nolabels, dark, light, open-street-map, outdoors, satellite, satellite-streets, stamen-terrain, stamen-toner, stamen-watercolor, streets, white-bg.",
"description": "Defines the map layers that are rendered by default below the trace layers defined in `data`, which are themselves by default rendered below the layers defined in `layout.map.layers`. These layers can be defined either explicitly as a Map Style object which can contain multiple layer definitions that load data from any public or private Tile Map Service (TMS or XYZ) or Web Map Service (WMS) or implicitly by using one of the built-in style objects which use WMSes or by using a custom style URL Map Style objects are of the form described in the MapLibre GL JS documentation available at https://maplibre.org/maplibre-style-spec/ The built-in plotly.js styles objects are: basic, carto-darkmatter, carto-darkmatter-nolabels, carto-positron, carto-positron-nolabels, carto-voyager, carto-voyager-nolabels, dark, light, open-street-map, outdoors, satellite, satellite-streets, streets, white-bg.",
"dflt": "basic",
"editType": "plot",
"valType": "any",
Expand All @@ -4255,9 +4255,6 @@
"outdoors",
"satellite",
"satellite-streets",
"stamen-terrain",
"stamen-toner",
"stamen-watercolor",
"streets",
"white-bg"
]
Expand Down
0